-
1. Re: any way to create Cache using remotecachemanger on a remote server?
galder.zamarreno Mar 29, 2012 6:32 AM (in response to venkataratnamteki)Not right now.
The best is to define all necessary caches in the server and retrieve them when needed. Caches are only started first time they're accessed, so shouldn't require more computing power until they're used, other than keeping the configuration around.
-
2. Re: any way to create Cache using remotecachemanger on a remote server?
venkataratnamteki Mar 29, 2012 6:48 AM (in response to galder.zamarreno)Is there any requirement for this usecase? because, in my current task, there are quite a few services, which try to create the cahces on the remote servers dynamically..
-
3. Re: any way to create Cache using remotecachemanger on a remote server?
dan.berindei Mar 29, 2012 2:06 PM (in response to venkataratnamteki)There is no enhancement request to allow defining and starting a new cache remotely. However, there is an enhancement request for its prerequisite https://issues.jboss.org/browse/ISPN-1147.
-
4. Re: any way to create Cache using remotecachemanger on a remote server?
chavarao Mar 30, 2012 4:10 PM (in response to dan.berindei)I have a requirement to create caches as we add more cahcing for new customers and I do not want to change xml all the time?
It would be nice it cacn create cache dynamically if cache not found instead of throwing cache not found error.
-
5. Re: any way to create Cache using remotecachemanger on a remote server?
venkataratnamteki Mar 31, 2012 1:52 AM (in response to chavarao)@Nag, even , my requirement is also almost same... i have a few web services, which request for the cache to be created either locally/remotely..
-
6. Re: any way to create Cache using remotecachemanger on a remote server?
chavarao Apr 3, 2012 11:44 PM (in response to venkataratnamteki)so whats the next step?
Its a good feature to add?
-
7. Re: any way to create Cache using remotecachemanger on a remote server?
dan.berindei Apr 4, 2012 3:35 AM (in response to chavarao)@Nag, please create an enhnacement request in the Infinispan JIRA.
A method to create a cache on all the cluster members does look like a good idea, but we need to answer some questions first:
- Is it absolutely necessary to expose this through HotRod, are you fine with a JMX operation?
- Do you need do define new cache configurations from scratch, or is it ok to just copy the configuration of a "template" cache that's already defined?
-
8. Re: any way to create Cache using remotecachemanger on a remote server?
chavarao Apr 6, 2012 10:43 AM (in response to dan.berindei)I think it will be easier for people to create through hot rod.
I was thinking there should be a flag to create cache automatically or not ( example global setting in hot rod client properties) If its set create cache automatically using default cache configuration.
So default cache configuration is the template to use.
-
9. Re: any way to create Cache using remotecachemanger on a remote server?
venkataratnamteki Apr 9, 2012 7:18 AM (in response to chavarao)@Nag & @Dan Berindei,
I am just thinking of an approach to create cache on remote node..
Expose an API( say - createRemoteCache(name) ) through webservice on the remote node. and this API will be like below.
@WebMethod
public boolean createRemoteCache(@WebParam(name = "cachename")String name);
public boolean createRemoteCache(String cacheName) {
EmbeddedCacheManager em= new DefaultCacheManager();
Cache<Object, Object> cache= em.getCache(cacheName,true);
return cache != null;
}
And, i will call this API from the client node..
I am yet to test this out. any idea whether this will work?
-
10. Re: any way to create Cache using remotecachemanger on a remote server?
dan.berindei Apr 9, 2012 4:31 PM (in response to venkataratnamteki)@Teki, this should work, but you will need to call the webservice on all the cluster members - HotRod requests are directed more or less random, so unless you have the cache running everywhere you will still get errors. This is pretty much the same as using the startCache method of the CacheManager JMX bean.
-
11. Re: any way to create Cache using remotecachemanger on a remote server?
venkataratnamteki Apr 10, 2012 12:40 AM (in response to dan.berindei)Hi Dan,
I have tried this through a stand alone program. but doesnt seem to work.
On Server1, i have hotrod server running(default: 11222). On the same server, i have a stand alone program which does the below.
EmbeddedCacheManager ecm = new DefaultCacheManager();
Cache<String, String> nc = ecm.getCache("newCache1", true);
nc.put("nkey1", "nvalue1");
nc.put("nkey2", "nvalue2");
Now this should create a cache on server1, and there should be 2 key-value pairs..
On Server2,(which is in same network), i have a stand alone java program which does below.
RemoteCacheManager rcm = new RemoteCacheManager("192.168.1.14", 11222); -->server1 ip and port
RemoteCache<String, String> nc1 = rcm.getCache("newCache1", true);
System.out.println(nc1.get("nkey1")); - ----------------> Null pointer exception here, because could not located cache..
But i am getting NPE at line#3.
Any hints?
-
12. Re: any way to create Cache using remotecachemanger on a remote server?
galder.zamarreno Apr 11, 2012 7:00 AM (in response to venkataratnamteki)I guess you're expecting for server1 and server2 to be clustered? If so, most likely the cluster is not being formed and hence not being replicated.
-
13. Re: any way to create Cache using remotecachemanger on a remote server?
venkataratnamteki Apr 11, 2012 11:26 AM (in response to galder.zamarreno)No,
server1 is like "server" and server2 is like "client". I am trying to access the cache which is created the server1..from server2.
-
14. Re: any way to create Cache using remotecachemanger on a remote server?
galder.zamarreno Apr 11, 2012 11:30 AM (in response to venkataratnamteki)Ah, in that case, you have started a cache manager, but this is different to the one the Hot Rod server uses? Most likely.
You should really use the Hot Rod server remotely, so if you wanna store data on it, use the same code as you use from server2, except that you call the put operations.