-
1. Re: Need help in capturing event when an node leaves or joins cluseter
wdfink Feb 13, 2015 3:51 AM (in response to dukechandu)1 of 1 people found this helpfulA simple way is to use the logfile.
You might use log4j and filter the cluster messages for "New cluster view" and send an email.
Another option is to use an external process to watch the logfile and filter the message.
-
2. Re: Need help in capturing event when an node leaves or joins cluseter
dukechandu Feb 13, 2015 8:06 AM (in response to wdfink)thank you for the responce
-
3. Re: Re: Need help in capturing event when an node leaves or joins cluseter
pferraro Feb 14, 2015 10:39 AM (in response to dukechandu)1 of 1 people found this helpfulThere are ways to detect this programmatically, but I'm not sure which version of AS/WildFly you are using. In WF9, the easiest way to do this is to leverage the public clustering API.
e.g.
@Startup @Singleton public class MyViewChangeDetector implements Group.Listener { @Resource(lookup = "java:jboss/clustering/group/default") private Group group; @PostConstruct public void init() { this.group.addListener(this); } @PreDestroy public void destroy() { this.group.removeListener(this); } @Override public void membershipChanged(List<Node> previousMembers, List<Node> members, boolean merged) { // Send email } }
... where "default" refers to the default channel of the node (as defined by the jgroups subsystem configuration).
-
4. Re: Re: Need help in capturing event when an node leaves or joins cluseter
dukechandu Feb 14, 2015 11:23 AM (in response to pferraro)HI,
i am using jboss 6.2 eap , jgroups 3.2 with java and not using wildfly package.
using ehcache, which will take jgroups.xml as paramater, and forms cache.
do we have anything similar implementation with jgroups.jar ?
Thanks in advance
-
5. Re: Re: Re: Need help in capturing event when an node leaves or joins cluseter
pferraro Feb 16, 2015 1:48 PM (in response to dukechandu)Probably the easiest way to do this pre-WildFly is to use Infinispan directly.
e.g.
@Startup @Singleton @Listener public class MyViewChangeDetector { @Resource(lookup = "java:jboss/infinispan/container/server") private EmbeddedCacheManager manager; @PostConstruct public void init() { this.manager.addListener(this); } @PreDestroy public void destroy() { this.manager.removeListener(this); } @ViewChanged public void viewChanged(ViewChangedEvent event) { // Send email } }
-
6. Re: Re: Re: Need help in capturing event when an node leaves or joins cluseter
dukechandu Feb 16, 2015 4:33 PM (in response to pferraro)you are suggesting to use Infinispan jar files ?
i don't know the difference or advantages of jgroups with Infinispan, is jgroups and Infinispan both are different or alternative implementation of jgroups ?.
i am just using jgroups and replicationcache.
Thanks
-
7. Re: Re: Re: Need help in capturing event when an node leaves or joins cluseter
pferraro Feb 16, 2015 6:10 PM (in response to dukechandu)You don't need to add any jar files to your application. Just export the relevant org.infinispan module to your application.
See: Class Loading in WildFly - WildFly 8 - Project Documentation Editor
In EAP6, the transport of an Infinispan cache manager uses a JGroups channel. In other words, one is a building block of the other.
-
8. Re: Re: Re: Need help in capturing event when an node leaves or joins cluseter
dukechandu Feb 16, 2015 6:21 PM (in response to pferraro)we are using Replcated Caching Using RMI, you are suggesting in stead of RMI cache , if we use Infinispan cache maanger it will work,.
Thanks for the response, i will go through documentation once.