1 2 3 Previous Next 30 Replies Latest reply on Apr 6, 2011 1:01 PM by jaikiran

    Two jboss with hornetq

    techy_kans

      Hi All

       

      I am trying to imitate a setup in my local system similar to that of DEV and TEST environment. A tomcat server , a JMS server and  Business Server. Both JMS server and Business Server are JBOSS servers using hornetq. In the dev/test environment, the  hornetq-configuration.xml of jmsserver and business server has the following values

       

      <acceptor name="netty">

               <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>

               <param key="host"  value="${hornetq.remoting.netty.host:jmserver.abc.com"/>

               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </acceptor>

       

      <acceptor name="netty">

               <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>

               <param key="host"  value="${hornetq.remoting.netty.host:bizserver.abc.com}"/>

               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </acceptor>

       

      Now the following question arises

      a. How does bizserver.abc.com looks up jmsserver.abc.com to read the messages ?

      b. How the same can be implemented in my local system running two instances of jboss..both jboss' physical locations are different and both are running at different ports 8080 and 8180 the jndi port are 1099 and 1199

       

      Which file should be changed in which jboss so the business jboss looks up at JMS jboss to read the messages

        • 1. Two jboss with hornetq
          clebert.suconic

          I'm not sure what you're trying to accomplish. If you are trying to accomplish clustering, a component in one of the servers to send a message on the other server or if you are trying to create a bridge.

           

           

          In any case, take a look at these following subjects on the manual:

           

          - acceptors

          - connection factory creation

          - bridges

          • 2. Two jboss with hornetq
            techy_kans

            Its simple. What i am trying to achieve is.. run two JBOSS servers both of them have hornetq embedded in it

             

                      ------------------>          ------------------>

            Web                         JMS                         Business

                      <------------------         <------------------

             

            Now both JMS and Business are JBOSS servers having Hornet

            I am able to send a message to JMS server. But business is not picking up

            JMS jndi is running in 1199 port and Business is running in 1099 port

             

            Hope you are clear.

            • 3. Re: Two jboss with hornetq
              ataylor

              That doesn't really help us help you, how are you sending messages to the server, where is the client, how are the 2 servers connected, are they clustered, connected by a bridge or are you just using normal client code from within your JEE components. If you explain what topology you actually want then maybe we can help.

               

              A

              • 4. Two jboss with hornetq
                techy_kans

                The web is using a normal JNDI lookup  port 1199 and places the object in the queue.

                The JMS Server is a hornetq JBOSS server running in localhost:1199 JNDI & http is localhost:8180

                The Business Server is also a hornetq JBOSS server in which the listener is deployed. This is running in localhost:1099 JNDI and http is localhost:8080

                The servers are not connected (expecting a solution for implementing)

                No clusters and no queue.

                I have got two instances of jboss installed in two different locations and running in different ports. I want one server to pick messages from the other server in which the queue is configured.

                Hope its clear..

                • 5. Two jboss with hornetq
                  ataylor

                  again, you havent told us how you want your topology, are you using MDB's, normal clients, EJB's, how do yopu want to deliver the message, how and where do you wanrt to consume your message.

                   

                  If you ask us some specific questions maybe we can help.

                  • 6. Two jboss with hornetq
                    techy_kans

                    1. Topology ?- I am trying to imitate an architecture in my local system similar to that of my DEV environment (where the Queue and Business servers are different)

                    2. Using MDB . The MDB listener is deployed in the Business JBOSS hornetq server . The PRequestListener class is deployed inside a ear file in the business server.

                     

                    @MessageDriven(activationConfig =

                    {

                      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),

                      @ActivationConfigProperty(propertyName="destination", propertyValue="queue/ServiceRequest"),

                      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")

                    })

                    @TransactionManagement(value = TransactionManagementType.CONTAINER)

                    @TransactionAttribute(value = TransactionAttributeType.REQUIRED)

                     

                    @ResourceAdapter("hornetq-ra.rar")

                    public class PRequestListener implements MessageListener{

                          public void onMessage(Message message) {

                               //Call EJB..

                          }

                    }

                     

                    3. The business JBOSS Hornetq Server has this EAR running in it and it should consume the message from the "ServiceRequest" queue which is configured in JMS Server .

                    • 7. Two jboss with hornetq
                      ataylor

                      You keep giving me half the story, tell me what full topolgy you want and maybe i can help. something like:

                       

                      I have 2 servers A & B, server B has an MDB that consumes from queue q which is on server A, server A has one remote client that sends messages to the queueq on server A.

                      I'mtrying to make assumptions as to what your trying to acheive but don't really know what you want.

                      • 8. Two jboss with hornetq
                        techy_kans

                        Andy thanks for the instant reply.

                         

                        Well i understood the topology. (This is in DEV/TEST/PROD environments)

                         

                        1.I have got three servers - Server A, Server B, Server C

                        2.Server A is a tomcat server

                        3.Server B and Server C both are JBoss 5.1.0 GA servers with Hornetq 2.0.0.GA

                        4.A web application is running on Server A

                        5.Server B is configured with a request queue and a response queue.

                        6.Server C has the Listener class which listens to Server B's request queue, invokes the EJB for the business process and send the response to the response queue. The Server A would pick up the result from the response queue and displays in the web.

                         

                        Now i want the same kind of architecture to be implemented in my local system also. I have got three servers.

                         

                        a. One tomcat running in 7777 port(i would access the application by localhost:7777/mywebapp/index.jsp)

                        b. One hornetq installed jboss running http in localhost:8180 and jndi in localhost:1199

                        c. One hornetq installed jboss running http in localhost:8080 and jndi in localhost:1099

                         

                        I configured the request and response queues in the first jboss running at 8180 and 1199

                        I deployed the MDB listener in second jboss running at 8080 and 1099.

                         

                        When the web app is executed, its able to place the object in the queue configured in the JBOSS running at 8180 and 1199.

                        But the consumer count is zero when i saw the jmx-console of the first jboss

                         

                        I want the listener in the second jboss to pick up the messages from the first jboss

                         

                        Hope this is clear.

                        • 9. Two jboss with hornetq
                          ataylor
                          Well i understood the topology. (This is in DEV/TEST/PROD environments)

                          Well i expect ytou would as its your topology, however i had to make some assumptions.

                           

                          1.I have got three servers - Server A, Server B, Server C

                          2.Server A is a tomcat server

                          3.Server B and Server C both are JBoss 5.1.0 GA servers with Hornetq 2.0.0.GA

                          4.A web application is running on Server A

                          5.Server B is configured with a request queue and a response queue.

                          6.Server C has the Listener class which listens to Server B's request queue, invokes the EJB for the business process and send the response to the response queue. The Server A would pick up the result from the response queue and displays in the web.

                          Ok got it.

                           

                          Well, its exactly the same running locally, theres no actual difference apart from configuring your host and ports in the appropriate place. Im guessing one of your components is configured wrong and a client is connecting to a wrong server.

                           

                          Theres not really much i can do to help you. If you are having problems with how to configure specific components then feel free to ask.

                          • 10. Two jboss with hornetq
                            techy_kans

                            I could see only the jndi properties . I have changed the following at the Business Server

                             

                            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

                            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

                            java.naming.provider.url=localhost:1199

                             

                            But still the message is not picked up?

                            Where are we configuring the host and port? any configuration.xml files?

                            • 11. Two jboss with hornetq
                              ataylor

                              all these things should be in the same place you configured them previously, however:

                               

                              The HornetQ connectors and Acceptors are defined in hornetq-configuration.xml

                               

                              The MDB is either configured in the MDB itself or the ra,xml config file and the jms-ra.xml files.

                               

                              I'm not sure where jndi is configured as its nothing to do with HornetQ and i dont know how/where you are using it.

                               

                              All this is in the user manual, have you looked at it?

                              • 12. Two jboss with hornetq
                                techy_kans

                                Yes. But

                                 

                                1. We use JNDI in the web to look up the queue and then post message

                                2. I could understand the concept of connectors and acceptors

                                    The one which establishes a connection to  the hornet queue is the connector and the one which accepts a connection is an acceptor. By this definition Business service is the connector and JMS server is the acceptor. BUT when i went through the hornetq-configuration.xml in the dev/test environments, i found that they have given the values of the server name itself

                                 

                                The one in JMS server is

                                 

                                <acceptor name="netty">

                                         <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>

                                         <param key="host"  value="${hornetq.remoting.netty.host:jmserver.abc.com"/>

                                         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                                      </acceptor>

                                 

                                The one in business server is

                                 

                                <acceptor name="netty">

                                         <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>

                                         <param key="host"  value="${hornetq.remoting.netty.host:bizserver.abc.com}"/>

                                         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                                      </acceptor>

                                 

                                Considering my business server as the connector and JMS server as acceptor, i tried giving only either connector or acceptor, but the business is not picking up the message in JMS server

                                • 13. Two jboss with hornetq
                                  ataylor
                                  1. We use JNDI in the web to look up the queue and then post message

                                  Ok, and? is this working correctly? does the message get sent to the correct queue on the correct server?

                                   

                                  2. I could understand the concept of connectors and acceptors

                                      The one which establishes a connection to  the hornet queue is the connector and the one which accepts a connection is an acceptor. By this definition Business service is the connector and JMS server is the acceptor. BUT when i went through the hornetq-configuration.xml in the dev/test environments, i found that they have given the values of the server name itself

                                  An acceptor defines what host and port HornetQ will listen on, A connector defines where a client (who looks up this by jndi) will try and connect to.

                                   

                                  I cant help you until you give me some info that actually means something.

                                  • 14. Re: Two jboss with hornetq
                                    techy_kans

                                    1. Its looking up using JNDI and able to post a message to that queue

                                    2. But the point to be noted is - In Dev Environment the hornetq-configuration.xml has both connectors and acceptors but the host is different i.e., in the business server its bizserver.abc.com and in JMS server it is jms.abc.com.  So if the host is local host, it does not seems to be working.

                                     

                                     

                                     

                                     

                                    i tried the following two points

                                      The hornetq-configuration.xml of JMS Jboss server has got only acceptors with host:port value as localhost:5445

                                      The hornetq-configuration.xml of Business Jboss server has got only connectors with host:port value as localhost:5445

                                    But failed.

                                     

                                     

                                    Hope i have thrown some light.

                                     

                                    To be more crispy.. have got two jboss server running in my machine (under the same jvm..i think so). I am posting an object in the queue which is configured in the first server and expecting a listener (MDB)  which is deployed in the second server, to pickup and process the message.

                                    1 2 3 Previous Next