1 2 Previous Next 19 Replies Latest reply on Oct 22, 2012 5:49 AM by smswamy

    JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ

    smswamy

      Hi,

         We have a requirement to use the plain old JMS queue configuration in JBOSS AS .

      In JBOSS AS 7.1.0, it seems the default JMS queue component implementation is via HornetQ.

      In our project, we need to do Queue Clustering and we cant use Multicast.

       

      Will someone please clarify how to configure the JMS in JBOSS AS 7.1.0. Also how to do JMS queue clustering without multicast in JBOSS AS 7.1.0.

       

      I had already tried out HornetQ configuration in the standalone.xml and it works great. But our requirement is without HornetQ, how to achieve queue clustering.

       

      Thanks

        • 1. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
          jbertram

          Will someone please clarify how to configure the JMS in JBOSS AS 7.1.0.

          Have you read the documentation here or here?

           

          Also how to do JMS queue clustering without multicast in JBOSS AS 7.1.0.

          Have you read this part of the HornetQ documentation on "static" discovery (i.e. discovery not using UDP)?

           

          I had already tried out HornetQ configuration in the standalone.xml and it works great. But our requirement is without HornetQ, how to achieve queue clustering.

          HornetQ is currently the only available JMS implementation for AS 7.  If you can't get HornetQ to do what you want then you'll need to use a different broker external to AS 7 or write a new subsystem to support a different broker within AS 7.

          • 2. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
            jaikiran

            muthuswamy s wrote:

             

             

            I had already tried out HornetQ configuration in the standalone.xml and it works great. But our requirement is without HornetQ, how to achieve queue clustering.

             

             

            Just out of curiosity - why is that a requirement? Is there some other specific JMS implementation that you have in mind?

            • 3. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
              smswamy

              Sorry, I was new to JBoss AS7.1. Also we had tried out JBOSS clustering using static IP's in JBOSS AS5.1..We were thinking if there is a way we can use the same configuration for working with JBOSS AS 7.1.0 (without HornetQ).

               

              Its fine, I think we can go with the HornetQ.

              • 4. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                smswamy

                Need some more clarification. Does JBOSS AS 7.1.0 support RabbitMQ for JMS Implementation.

                 

                Consider we may have around 5 producers, around 10 consumers and a maximum of 1,00,000 messages that may go into the queue. Also the object size that will go into the Queue may be around 10k(max).

                 

                In this scenario, do you think HornetQ is best or RabbitMQ ?

                 

                Thanks.

                • 5. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                  jbertram

                  If RabbitMQ has a JCA resource adapter then you can deploy that resource adapter in JBoss AS 7 and use it to integrate with RabbitMQ.  However, there is no support to deploy RabbitMQ itself into JBoss AS 7 and use it as a JMS broker.

                   

                  I think HornetQ would perform well for you given your use-case.

                  • 6. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                    smswamy

                    Hi Justin, (My problem may seem to be silly , still please help me :-) )

                                  I have made the Queue Clustering configuration.  I hope the below  information says the queue clustering is success...

                    I have 2 different systems A and B which are now HornetQ clustered (using Static Connectors).  When I send a message from system A and if I try to get the message using  the QueueListener in system B, I am not getting the message. If I send a message from System A and if the queue listener is in the System A, it works fine..

                     

                    Is there any ClusteredConnectionFactory(I remember using it in AS 5.1 ) we need to use ?

                     

                    Below is the code I use to send and get the message. Will you please let me know what is the problem ?

                     

                                                  ctx = new InitialContext();

                                                  conf = (ConnectionFactory) ctx

                                                                      .lookup("java:/ConnectionFactory");

                                                  connection =  conf.createConnection();

                    session = (Session) connection.createSession(false,

                                                                      Session.AUTO_ACKNOWLEDGE);

                     

                    In system A, I am trying to send a Message,

                     

                              MessageProducer messageProducer = session.createProducer(<queue object for ("queue/Testqueue")>);

                     

                                TextMessage objectMessage = session.createTextMessage();

                                objectMessage.setText((String) "My Test Message 1");

                                messageProducer.send(objectMessage);

                     

                    In system B, I am configuring the queue listener,

                     

                                                  MessageConsumer extractorConsumer = session.createConsumer(<queue object for ("queue/Testqueue")>);

                                                  extractorConsumer.setMessageListener(new TestQueueListener());

                     

                     

                     

                    12:05:47,831 INFO  [org.hornetq.core.server.cluster.impl.BridgeImpl] (Thread-9 (HornetQ-server-HornetQServerImpl::serverUUID=e420bcd5-8d31-11e1-8c61-00250045e8c4-506015451)) Bridge ClusterConnectionBridge@ea211cf [name=sf.my-cluster.7d08e54d-82d7-11e1-afee-109add5d2b6e, queue=QueueImpl[name=sf.my-cluster.7d08e54d-82d7-11e1-afee-109add5d2b6e, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=e420bcd5-8d31-11e1-8c61-00250045e8c4]]@323f348a targetConnector=ServerLocatorImpl (identity=(Cluster-connection-bridge::ClusterConnectionBridge@ea211cf [name=sf.my-cluster.7d08e54d-82d7-11e1-afee-109add5d2b6e, queue=QueueImpl[name=sf.my-cluster.7d08e54d-82d7-11e1-afee-109add5d2b6e, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=e420bcd5-8d31-11e1-8c61-00250045e8c4]]@323f348a targetConnector=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=localhost], discoveryGroupConfiguration=null]]::ClusterConnectionImpl@410572006[nodeUUID=e420bcd5-8d31-11e1-8c61-00250045e8c4, connector=org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=localhost, address=#, server=HornetQServerImpl::serverUUID=e420bcd5-8d31-11e1-8c61-00250045e8c4])) [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=localhost], discoveryGroupConfiguration=null]] is connected

                    • 7. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                      jbertram

                      Can you attach the standalone*.xml from both servers?

                      • 8. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                        smswamy

                        Please find attached the standalone files.

                        • 9. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                          smswamy

                          Hi Justin, I have attached the files. Please let me know what I need to change ...Thanks

                          • 10. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                            jbertram

                            Your configuration looks OK for the most part.  However, there are two main things you need to change:

                             

                            You don't need this acceptor:

                             

                                                <acceptor name="server1-connector">

                                                    <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                                                    <param key="host" value="0.0.0.0"/>

                                                    <param key="port" value="5445"/>

                                                </acceptor>

                             

                            If you want the server to listen on 0.0.0.0 then just pass "-b 0.0.0.0" on the command line when you start JBoss AS.

                             

                            Also, I recommend you set <redistribution-delay>0</redistribution-delay>.

                             

                            All that said, though, I don't believe the problem is related to configuration.  I think there is a bug somewhere that I'm still tracking down.  Can you use UDP discovery in the mean-time or can you only use static discovery?

                            • 11. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                              jbertram

                              Another possible work-around is to use HornetQ stand-alone rather than integrated with JBoss AS7.  I can't reproduce the problem with 2 statically clustered instances of standalone HornetQ.

                              • 12. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                                jbertram

                                I had misconfigured my environment by copying one instance of AS7 to create another which included the HornetQ journal.  Because of this, both nodes shared the same server ID (which is generated when the journal is created the first time) and that was breaking message redistribution.

                                 

                                I think your scenario should work properly if you set <redistribution-delay>0</redistribution-delay> in your <address-settings> and make sure that you didn't make the same mistake as me when created your cluster nodes (i.e. copying the journal from one server to another).

                                • 13. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                                  smswamy

                                  Hi Justin,

                                              That doesn't solve the problem. Please let me know how to identify the HornetQ journals are same or different in both systems. In the journal directory I see server.lock, hornetq-data-193.hq, hornetq-data-194.hq , hornetq-data-195.hq.

                                   

                                  If the files are same, what should I change ? Shall I delete the above files, will it regenerate.

                                   

                                  When clustering is getting established , in the message(please see in my May 17, 2012 message post), it says

                                   

                                  [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=localhost], discoveryGroupConfiguration=null]]

                                   

                                  My fear is it recognizes the Connector but not the acceptor. ? Do you see any issue in the message taken from server log. It clearly says discoveryGroupConfiguration is null ? Why ?

                                   

                                  Also you had said "If you want the server to listen on 0.0.0.0 then just pass "-b 0.0.0.0" on the command line when you start JBoss AS." Hope you are trying to say bind the server to the localhost or the specific instance on the local host.

                                   

                                  Is there an option for specifying hostname and port number for connector during Jboss AS 7.1.0 start.?

                                  • 14. Re: JMS Queue cluster Configuration in JBOSS AS 7.1.0 but not using HornetQ
                                    jbertram

                                    I'm not sure what the problem could be at this point. 

                                     

                                    It took the standalone_system_A.xml and standalone_system_B.xml you attached here, modified them slightly, and started a 2-node cluster on my local machine with one node bound to 127.0.0.1 and the other bound to 127.0.0.2.  I was able to send messages to one node and consume them on the other node.  Here are the modifications I made:

                                     

                                    1. Added <security-enabled>false</security-enabled> because I didn't want to mess with security during my tests.
                                    2. Changed the "host" <param> for the "server1-connector" on each node to point to the other node in the cluster.  For example, on the node bound to 127.0.0.1 I used:
                                                        <connector name="server1-connector">
                                                            <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                                                            <param key="host" value="127.0.0.2"/>
                                                            <param key="port" value="5445"/>
                                                        </connector>
                                    
                                    1. Completely removed the <acceptor name="server1-connector"> from both nodes.
                                    2. Used this <cluster-connections> configuration to move it more in line with the static clustering example shipped with HornetQ:
                                                    <cluster-connections>
                                                        <cluster-connection name="my-cluster">
                                                            <address>jms</address>
                                                            <connector-ref>netty</connector-ref>
                                                            <retry-interval>500</retry-interval>
                                                            <use-duplicate-detection>true</use-duplicate-detection>
                                                            <forward-when-no-consumers>false</forward-when-no-consumers>
                                                            <max-hops>1</max-hops>
                                                            <static-connectors>
                                                                <connector-ref>
                                                                    server1-connector
                                                                </connector-ref>
                                                            </static-connectors>
                                                        </cluster-connection>
                                                    </cluster-connections>
                                    
                                    1. Added <redistribution-delay>0</redistribution-delay> to the <address-setting match="#">.

                                     

                                     

                                    If the files are same, what should I change ? Shall I delete the above files, will it regenerate.

                                    To be safe I would delete the <JBOSS_HOME>/standalone/data directory.  It will be automatically re-created (along with the HornetQ journal) when you start JBoss AS7.

                                    1 2 Previous Next