2 Replies Latest reply on Oct 23, 2008 11:44 AM by Brad Fach

    JBoss callback for JMS Client

    Brad Fach Newbie

      Hello,

      I was wondering if there is a callback for the JMS Client in the event that a node enters the cluster? The purpose for this would be to inform the multiple connections that a new or restarted server has entered/reentered the cluster. The closest thing now is the ExceptionListener but this is only for the ConnectionFactory with supportsFailover set to false.

      Is there a callback to inform the client that the cluster state has changed?

      Thanks in advance,



        • 1. Re: JBoss callback for JMS Client
          Clebert Suconic Master

          You could maybe implement a LoadBalancingFactory, and set it up on the ConnectionFactory

          public class MyLoadbalancingFactory extends LoadBalancingFactory
          
          {
           public LoadBalancingPolicy createLoadBalancingPolicy(ConnectionFactoryDelegate[] view)
           {
           return new MyRoundRobinLoadBalancingPolicy(view);
           }
          
          }
          





          And MyRoundRobinLoadBalancingPolicy:
          public class MyRoundRobinLoadBalancingPolicy extends RoundRobinLoadBalancingPolicy
          
          {
           public synchronized void updateView(ConnectionFactoryDelegate[] delegates)
           {
           super.updateView(delegates);
           }
          
          
          }
          



          You should be notified on the client when an update happens on the topology.


          But if you don't really need a callback, on ClientConnectionFactoryDelegate, you will find the getTopology method.

          You probably need to access The ClientConnectionFactoryDeleget throught JBossConnectionFactory:


          (ClientClusteredConnectionFactoryDelegate)(((JBossConnectionFactory)cfFromJNDI).getDelegate).getTopology();


          • 2. Re: JBoss callback for JMS Client
            Brad Fach Newbie

            Hey,

            I am wondering if this could be a feature for JBM 2? This would allow the JMS Client to know when a new server has entered the cluster.