-
1. Re: NotificationBroadcasterSupport to a clustered environment in wildfly
pferraro Sep 14, 2015 1:22 PM (in response to sumanthreddybandi)The equivalent would be something like this:
@Resource(lookup = "java:jboss/clustering/group/default") private org.wildfly.clustering.group.Group group; public List<String> getNodes() { return this.group.getNodes().stream().map(node -> node.getName()).collect(Collectors.toList()); }
Where "default" is an alias to the default JGroups channel of the server.
-
2. Re: NotificationBroadcasterSupport to a clustered environment in wildfly
sumanthreddybandi Jan 17, 2016 5:17 PM (in response to sumanthreddybandi)Getting a NPE when i use the above code. i used "java:jboss/clustering/group/default" as well as ""java:jboss/clustering/group/ejb"
In both cases, group object is NULL.
Currrently i have only one node(node1). And in the logs, i am seeing the channel as 'ejb'
INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport:186] (ServerService Thread Pool -- 73) ISPN000078: Starting JGroups channel ejb
INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport:785] (ServerService Thread Pool -- 73) ISPN000094: Received new cluster view for channel ejb: [node1|0] (1) [node1]
INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport:224] (ServerService Thread Pool -- 73) ISPN000079: Channel ejb local address is node1, physical addresses are [xx.xx.xx.xx:xxx]
Am i missing anything here?
-
3. Re: NotificationBroadcasterSupport to a clustered environment in wildfly
pferraro Jan 18, 2016 9:03 AM (in response to sumanthreddybandi)It seems that when CDI is used to resolve @Resource annotations (as opposed to WF's ee subsystem), it fails to establish the appropriate dependencies required to start the Group service backing this. You can work around this by using a resource-ref in your deployment descriptor and reference the Group using an application-specific namespace.
e.g.
<resource-ref> <res-ref-name>group/default</res-ref-name> <lookup-name>java:jboss/clustering/group/default</lookup-name> </resource-ref>
@Resource(name = "group/default") private Group group;
-
4. Re: NotificationBroadcasterSupport to a clustered environment in wildfly
sumanthreddybandi Jan 18, 2016 4:27 PM (in response to pferraro)Still getting group as Null. But i am able to see the list of nodes with below code:
ObjectName name = null; MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { name = new ObjectName("jboss.infinispan:type=CacheManager,name=\"ejb\",component=CacheManager"); String clusterMembers = (String) (server.getAttribute(name, "clusterMembers")); log.info("Cluster Members: "+clusterMembers); } catch (Exception e) { e.printStackTrace(); }
In the logs:
[org.infinispan.remoting.transport.jgroups.JGroupsTransport:785] (ServerService Thread Pool -- 68) ISPN000094: Received new cluster view for channel ejb: [node2|1] (2) [node2, node1]
Cluster Members: [node2, node1]
Why am i not able to see cluster members with the JGroups channel?