I have started working to integrate Infinispan cache mechanism in my application.

We plan to deploy our application in a clustered mode for scalability. When operated in this mode, some user specific session data will be available with any of the nodes or almost all the nodes. Whenever user logs out, session data is cleaned up in the node which processes the logout call but the same data is available with other nodes of the cluster and requires cleanup to ensure we have consistent data across all the nodes.

The initial plan was to store the session data in to infinispan cache, but we rely on a third party server which enforces us to store some un-serializable data in to the cache. Due to this I am not able to use Infinispan cache as such.

So my approach was to use Event Listeners with Cache Manager and implement my session cleanup logic in the CacheEntryCreated event. I am using the below sample code

Using the above code, I am able to successfully start two Cache instances in two different machines and share data between them. Both handleStart() and handleStop() methods are triggered appropriately.

But when I add data to the cache using cache.put(key,value), the cacheEntryCreated() method is not triggered in both local as well as other nodes of the cluster.

Any thoughts/comments on my approach..?

I also want to know if CacheEntryCreated() will be triggered for the regular cache.put(key, value) method calls in both local as well as other nodes of the cluster.....

I stuck up at this point and any comments would be really appreciated.

I have also tested this through a Non-clustered simple java program (single node cache) in both Replicated and Distributed mode, where I could only see CacheStarted() and CacheStopped() events triggered.

Are you sure the 2 nodes see each other in the first place? EmbeddedCacheManager.getMembers() should give you a view of the cluster from each node's point of view. If they don't see each other you should revisit your JGroups cfg. Paste them here and someone will be able to help - or use one of the sample configs on the online tutorial.

From the beginning, the cluster nodes are starting up successfully and there are no issues with that. I could also see the data available with all my cluster nodes. But my problem is with the even listeners.

With above working setup, I have added a even listener to the cache manager which I expect to listen various events of the cache. But unfortunately it is able to capture only CacheStarted and CacheStopped events. Let me know if there are any specific configuration or specific APIs are needed to make the following listeners work