4 Replies Latest reply on Dec 14, 2007 3:58 PM by bodrin

    JBoss Messaging 1.4 - no clustered post office?

    bodrin

      (similar problem: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=103248&postdays=0&postorder=asc&start=0)

      I'm experiencing problems with the message redistribution between the cluster nodes. I'm running two server nodes jboss-4.2.0.GA with jboss-messaging-1.4.0.SP2 (http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.4.0.SP2/html/installation.html#install.automated).

      If the producer connects to one node, but the consumer on the another one it does not receive nothing from the queue. The queue is marked clustered in destinations-service.xml:

       <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=TestService"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
       <attribute name="Clustered">true</attribute>
       </mbean>
      


      The clients are using HA-JNDI to lookup the ClusteredConnectionFactory.
      Here is the list of jars used at the client side:
      ...
      @rem this one is a fixed version (?) obtained from http://jira.jboss.org/jira/browse/JBPAPP-402?page=history
      @set CP=%CP%;%JBOSS_HOME%/server/messaging-node0/lib/jboss-remoting.jar
      
      @set CP=%CP%;D:\research\MessageBus\JBossMQ\jboss-messaging-1.4.0.SP2\jboss-messaging-client.jar
      @set CP=%CP%;%JBOSS_HOME%/client/jbossall-client.jar
      
      @rem obtained from http://repository.jboss.com/jboss/aop/1.5.5.GA/lib/
      @set CP=%CP%;./lib/jboss-aop.jar
      
      @rem obtained from http://repository.jboss.com/javassist/3.5.0.GA-brew/lib/
      @set CP=%CP%;./lib/javassist.jar
      
      @rem obtained from http://repository.jboss.com/trove/1.0.2-brew/lib/
      @set CP=%CP%;./lib/trove.jar
      
      @set CP=%CP%;%JBOSS_HOME%/client/log4j.jar
      ...
      


      As I look at "JBoss Messaging 1.3 User's Guide" (http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.3.0.GA/html/index.html)
      section "7.3.2. Clustered post office" describes two interesting attributes:
       <mbean code="org.jboss.messaging.core.plugin.ClusteredPostOfficeService"
       name="jboss.messaging:service=PostOffice"
       xmbean-dd="xmdesc/ClusteredPostOffice-xmbean.xml">
      ...
      <!-- To favour the local queue -->
      <attribute name="ClusterRouterFactory">org.jboss.messaging.core.plugin.postoffice.cluster.DefaultRouterFactory</attribute>
      <!-- To round robin
      <attribute name="ClusterRouterFactory">org.jboss.messaging.core.plugin.postoffice.cluster.RoundRobinRouterFactory</attribute>
      -->
      
      <!-- For message redistribution -->
      <attribute name="MessagePullPolicy">org.jboss.messaging.core.plugin.postoffice.cluster.DefaultMessagePullPolicy</attribute>
      <!-- For no message redistribution
      <attribute name="MessagePullPolicy">org.jboss.messaging.core.plugin.postoffice.cluster.NullMessagePullPolicy</attribute>
      -->
      

      (Note that adding the above configuration does not work..)

      I need them in order to make something like a master/slave configured cluster of two nodes where:

      - consumers and producers are external (not running inside jboss cluster), jboss is used only as a messaging system
      - the messaging system should provide transperant failover (jboss messaging already does)
      - only the master node is used by default (runs on a better hardware box)
      Hashtable properties = new Hashtable();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      properties.put(Context.PROVIDER_URL, "master:1200,slave:1300");
      Context context = new InitialContext(properties);
      ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("/ClusteredConnectionFactory");
      

      <!-- To favour the local queue -->
      <attribute name="ClusterRouterFactory">org.jboss.messaging.core.plugin.postoffice.cluster.DefaultRouterFactory</attribute>
      

      - if there are producers and consumers connected to different nodes in the cluster they should continue running without any knowledge of what is actually happening
      <!-- For message redistribution -->
      <attribute name="MessagePullPolicy">org.jboss.messaging.core.plugin.postoffice.cluster.DefaultMessagePullPolicy</attribute>
      

      - if the master dies and is restarted then the slave should also be restarted in order to recover the inital state (using only the master node)


      So, currently the problem is that I do not see nothing about this Clustered post office from JBoss Messaging 1.3 into
      "JBoss Messaging 1.4 User's Guide" (http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.4.0.SP2/html/index.html)
      and do not know how to achieve the To favour the local queue via ClusterRouterFactory attribute and For message redistribution via MessagePullPolicy attribute.

      Could you please help?

      thanks,
      bobrin


        • 1. Re: JBoss Messaging 1.4 - no clustered post office?
          timfox

          Did you run the examples after installing JBoss Messaging? (see user guide).

          One of the examples tests a clustered queue. So if this works, you know that functionality works.

          Next step is to see how your code differs from the example code.

          • 2. Re: JBoss Messaging 1.4 - no clustered post office?
            bodrin

            Thanks, Tim!

            The example works fine (nice ant scripts :), so I suppose the problem is in my code and I have to investigate it ..

            I saw your comment at JIRA: "MessagePullPolicy no longer exists"
            So, message redistribution is enabled by default and there is no way to be disabled any more, right?

            The other question still remains - is there a way to disable the round robin behaviour of the ClusteredConnectionFactory?

            I need a way to choose the cluster node and use it if it is up and running. The HAJNDI provides a way to do it, and if the ClusteredConnectionFactory favours the local queue it will be ok I think..

            • 3. Re: JBoss Messaging 1.4 - no clustered post office?
              timfox

               

              "bodrin" wrote:
              Thanks, Tim!

              The example works fine (nice ant scripts :), so I suppose the problem is in my code and I have to investigate it ..

              I saw your comment at JIRA: "MessagePullPolicy no longer exists"
              So, message redistribution is enabled by default and there is no way to be disabled any more, right?


              You can disable it.
              http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.4.0.SP2/html/configuration.html#conf.serverpeer.attributes.clusterpullconnectionfactory


              • 4. Re: JBoss Messaging 1.4 - no clustered post office?
                bodrin

                nice, should be in bold I think..

                But, is there a way to disable the round robin behaviour of the ClusteredConnectionFactory?