Cache name is used when we configure coherence adapter. We need to take special care when we give value to this property, if we provide wrong value then coherence adapter will not work and throw error.
We saw how to configure coherence adapter, if you didn't read that click here to read that post. While we configure the adapter we can use default JNDI or custom JNDI. Based upon which JNDI we use we need to provide cache name. As we saw in previous post, when we use default JNDI then we need to use “adapter-local” as cache name. But if we don’t want to use that name then we have to create custom JNDI.
In this post, we see how to create custom coherence adapter JNDI and how to use custom cache name.
Before we create the outbound connection pool in admin console, we need to create cache config file. As we saw in previous post, there is one config file associated with each outbound connection pool. So first take default config file and make changes to it.
Change the name of file from adapter-local-cache-config à adapter-Sample-cache-config
Then change the content, provide your cache name.
You can download the sample file from here.
Now we will create outbound connection pool.
To create custom JNDI, first go to admin console then go to Deployments àCohereneAdapter à Configuration à Outbound Connection pool
Click on New to create new outbound connection pool.
Provide outbound connection pool name and click on next.
Once you are done with outbound connection pool creation then go to newly created outbound connection pool.
Provide the cache config file location; we already created this file in earlier step.
Also provide Service name.
Once you are done then update the adapter. Now you can use this custom cache name in your adapter.