Why do you want to listen to those notifications in your application?
The clients do repeating invocations of EJB methods during their lifetime. Therefore, the connection must be kept open. When the server goes down, the invocations to the clients fail with the stack trace shown below. I need to know when the connection goes down so i can prevent further invocations of EJB methods and go into some kind of "offline-mode".
Exception in thread "Thread-2" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:***,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@313170 at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) at $Proxy1.heartbeat(Unknown Source) at foo.bar.Heartbeat.run(Heartbeat.java:40) at java.lang.Thread.run(Thread.java:662)
If you have to go into offline mode then you have two options:
1) Use JBoss Remoting and EJB client APIs to create and manage the connections on your own and you can then receive such notifications from JBoss Remoting
2) Rely on the IllegalStateException with a message id of EJBCLIENT000024 which suggests that there was no receiver available for handling this invocation (there can be many reasons why the receiver isn't available, one being the server was down, but in any case the invocation can't proceed).