HotRod ClientListener is not getting updated view for HotRod serevr?

108 Views Asked by At

I have 2 HotRod server running in REPL_ASYNC mode. I am trying to connect it using hotrod client by providing hotrod server address and port.

I am trying to implement functionality similar to Near Cache. the reason behind not using Nearcache to avoid RPC call. We want to have control on Remote call done by NearCache. I implemented all the logic along with Notification Listener. So for that I am trying to attach ClientListener on RemoteCache and then wanted to take action on event notification. it's working as expected when all the servers are running. but it is not getting updated server view when one of the hotrod server getting stopped or new server being added. while when I am running hotrod client without ClientListener I am getting updated view of server.

Any one have idea about it please share I tried a lots of things but no success.

Please suggest if anyone have come across this issue?

Update : getting updated view whenever we do get operation but if no get operation perform then not getting updated topology view

Configuration used :

final ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.clustering().stateTransfer().awaitInitialTransfer(true);
configurationBuilder.clustering().stateTransfer().fetchInMemoryState(true);
configurationBuilder.clustering().sync().replTimeout(15000);
configurationBuilder.clustering().cacheMode(CacheMode.REPL_ASYNC);
configurationBuilder.dataContainer().compatibility().enable();configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);configurationBuilder.storeAsBinary().enable().storeKeysAsBinary(false).storeValuesAsBinary(false);
configurationBuilder.jmxStatistics().enabled(true);
configurationBuilder.eviction().strategy(LIRS);
configurationBuilder.eviction().maxEntries(25000);
configurationBuilder.expiration().lifespan(-1);
1

There are 1 best solutions below

4
On

I am able to resolve this issue by applying below workaround, might help someone having similar issue :

In hotrod server I had a default cache on top of that I had created to cache. on client side I have attached listener to my cache but infinispan internally was using default cache while doing ping operation to fetch topology view. as I have attached listener to just our own cache and it wasn't default cache either it was not able to get the updated view on ping operation.

To solve this I have made one of the cache as default cache by using below code

new HotRodServerConfigurationBuilder().defaultCacheName("cacheName")

hope this will help someone who have similar issue.