Listener (Clustered) on other node(s) not being called when item added to cache
jadiyo1971 Sep 10, 2018 3:51 AMHello,
I am struggling to get Listeners to fire on nodes within a cluster.
I am using Infinispan 9.1.7.Final in Embedded Cache Manager.
The application will run on multiple nodes/openshift pods, but for now, this is just running 2 instances of JBoss on my local machine.
Based on the logs for each node, the nodes seem to be able to see each other.
Node A Logs:
2018-09-08 13:55:43,324 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 64) ISPN000078: Starting JGroups channel GAP_App_Cache_Cluster_REPL_SYNC
2018-09-08 13:55:43,324 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 64) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2018-09-08 13:55:43,592 WARNING [org.jgroups.stack.Configurator] (ServerService Thread Pool -- 64) JGRP000026: unable to find an address other than loopback for IP version IPv6
2018-09-08 13:55:48,760 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 64) ISPN000094: Received new cluster view for channel GAP_App_Cache_Cluster_REPL_SYNC: [LG013868-50835|0] (1) [LG013868-50835]
2018-09-08 13:55:48,763 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 64) ISPN000079: Channel GAP_App_Cache_Cluster_REPL_SYNC local address is LG013868-50835, physical addresses are [0:0:0:0:0:0:0:1:62020]
Also, when Node B starts up, the Node A logs show this:
2018-09-08 13:57:23,847 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-2,LG013868-50835) ISPN000094: Received new cluster view for channel GAP_App_Cache_Cluster_REPL_SYNC: [LG013868-50835|1] (2) [LG013868-50835, LG013868-50409]
2018-09-08 13:57:23,852 INFO [org.infinispan.CLUSTER] (Incoming-2,LG013868-50835) ISPN100000: Node LG013868-50409 joined the cluster
Node B Logs:
2018-09-08 13:57:23,242 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 84) ISPN000078: Starting JGroups channel GAP_App_Cache_Cluster_REPL_SYNC
2018-09-08 13:57:23,242 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 84) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2018-09-08 13:57:23,506 WARNING [org.jgroups.stack.Configurator] (ServerService Thread Pool -- 84) JGRP000026: unable to find an address other than loopback for IP version IPv6
2018-09-08 13:57:23,872 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 84) ISPN000094: Received new cluster view for channel GAP_App_Cache_Cluster_REPL_SYNC: [LG013868-50835|1] (2) [LG013868-50835, LG013868-50409]
2018-09-08 13:57:23,875 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (ServerService Thread Pool -- 84) ISPN000079: Channel GAP_App_Cache_Cluster_REPL_SYNC local address is LG013868-50409, physical addresses are [0:0:0:0:0:0:0:1:54556]
So it looks like the nodes can see each other.
When Node A adds an entry in to the Cache. The Listener I have attached to the Cache, fires on Node A only.
Nothing happens on Node B.
The Listener is anotated as follows:
@Listener(clustered=true)
I am only listening for @CacheEntryCreated , which I believe is supported by Clustered Listeners.
:
The following is the Cache Manager configuration:
private EmbeddedCacheManager cacheManager = null;
..
..
..
public void init() {
ConfigurationBuilder cfg = new ConfigurationBuilder();
CacheMode selectedCacheMode = CacheMode.REPL_SYNC;
cfg.clustering().cacheMode(selectedCacheMode);
cfg.indexing();
cfg.clustering().create();
GlobalConfigurationBuilder globalConfigurationBuilder = GlobalConfigurationBuilder.defaultClusteredBuilder();
globalConfigurationBuilder.globalJmxStatistics().allowDuplicateDomains(true);
globalConfigurationBuilder.transport().clusterName("GAP_App_Cache_Cluster_"+selectedCacheMode);
cacheManager = new DefaultCacheManager(globalConfigurationBuilder.build(), cfg.build());
cacheManager.start();
}
I have been trying for some time now to get this part working and it so any help would be greatly appreciated.
Many thanks