First of all, my condolences are that you need to choose a road that traveled less.
It is possible to access the built-in Infinispan cache remotely. You need to configure org.infinispan.server.hotrod.HotRodServer in your server process, essentially redesigning the pre-packaged Infinispan Server distribution. This approach is not documented, so act at your own risk .
You need these dependencies:
<dependency> <groupId>org.infinispan</groupId> <artifactId>infinispan-server-hotrod</artifactId> <version>7.1.0.Final</version> </dependency> <dependency> <groupId>org.infinispan</groupId> <artifactId>infinispan-client-hotrod</artifactId> <version>7.1.0.Final</version> </dependency> <dependency> <groupId>org.infinispan</groupId> <artifactId>infinispan-remote-query-server</artifactId> <version>7.1.0.Final</version> </dependency>
Set up an example cache ( infinispan.xml ):
<infinispan> <cache-container default-cache="default"> <local-cache name="dumpster"> <compatibility /> </local-cache> </cache-container> </infinispan>
Server process:
Client process:
Configuration config = new ConfigurationBuilder().addServer() .host("127.0.0.1").port(9999).build(); RemoteCacheManager cacheManager = new RemoteCacheManager(config); RemoteCache<String, String> cache = cacheManager.getCache("dumpster"); System.out.println(cache.get("K"));
source share