1 2 3 Previous Next 35 Replies Latest reply on Dec 20, 2013 11:52 AM by mike just

    Is there a way to configure jms request working on another server

    mike just Master

      Hi Guys,

       

      I have a thought about seperating the jms requests to another server (server2) and only processing basic requests on server1. This is considered for reducing server1's pressure when there are a lot of jms requests coming into the server, then moving the jms request to another configured server could make server1 perform much better.

       

      Is there a method to do this in jboss eap 6.1.0.alpha1 version?

        • 1. Re: Is there a way to configure jms request working on another server
          Wolf-Dieter Fink Master

          What you try to do?

          Is it the same queue/topic and you have MDBs and need to restrict the number of instances?

          It is not clear to me what the scenario is about.

          • 2. Re: Is there a way to configure jms request working on another server
            mike just Master

            Sorry, what I meant is to transfer jms requests from server1 to server2 so that server1 only focuses on basic business request handling and server2 focuses on jms request handling. In this way, server1 can obtain better performance since it will not handle any jms request on it.

             

            Is this clear enough?

            • 3. Re: Is there a way to configure jms request working on another server
              Anders Welen Apprentice

              Do you mean that you do not want to use server1 for JMS at all, I would recommend you to setup a JCA adapter pointing to your server2 JMS provider in server1, and make sure that all your producers using a connection from a pool that is configured to that JCA adapter.

              • 4. Re: Is there a way to configure jms request working on another server
                mike just Master

                Thanks, Anders. We could do that, but a switch is preferred so that we can still use server1 for JMS if we do not want to use server2 in the future.

                 

                And can you show me a little more details about how to setup the JCA adapter? Or is there any document about this guide? Much appreciated.

                • 5. Re: Is there a way to configure jms request working on another server
                  Anders Welen Apprentice

                  I believe that there is an example in the HornetQ quickstarts.

                  Perhaps you can look at the possibility to use HornetQ bridges instead (but that will use computer resources locally and that is what you want to avoid). I haven't tested it between instances though...

                  • 6. Re: Is there a way to configure jms request working on another server
                    mike just Master

                    Do you mean setup hornetq HA with a mod_cluster? I have tried that but met with some problems, which is why I am now asking for this in this thread.

                     

                    If you can share with me how to setup the JCA adapter and how to configure the producers, that will be much helpful.

                     

                    I have just had a quick view on the hornetq quickstarts

                    Chapter 7. Running the Examples

                    but seems no more useful information is found about the JCA adapter. Can you advise?

                    • 7. Re: Is there a way to configure jms request working on another server
                      Anders Welen Apprentice

                      No I didn't mean anything with mod_cluster.

                       

                      - So your JMS producers are remote and not running within server1 or server2?

                      - Are the two servers running in a cluster?

                       

                      Look at http://planet.jboss.org/post/jboss_as7_and_jca for an generic example of a connection factory setup for a JCA adaptor.

                      Just make sure that your producers (if they are running with the server) using "java:/eis/AcmeConnectionFactory" as their connection factory.

                      • 8. Re: Is there a way to configure jms request working on another server
                        mike just Master

                        the JMS producers are running within server1.

                         

                        And they are not running in a cluster.

                         

                        So it is possible to do the JMS transfer without configuring mod_cluster or cluster at all? If it is this case, then that will be much better because what I am trying to find is only how to transfer the JMS requests to another server at lowest cost.

                        • 9. Re: Is there a way to configure jms request working on another server
                          Justin Bertram Master

                          You can configure a local <pooled-connection-factory> so that a local producer can send messages to a remote server, but http://planet.jboss.org/post/jboss_as7_and_jca is not what you want to read.  The <pooled-connection-factory> is configured in <hornetq-server> and leverages the HornetQ JCA RA under the covers.  All you need to do is configure a new <connector> which points to the remote server and configure the <pooled-connection-factory> to use that <connector>.  Then, of course, you'll need to change your producers to use this new connection factory.

                           

                          That said, it's probably easier just to configure a HornetQ core bridge to move the messages to the remote server so you don't have to modify the producers.  A core bridge is very light weight.

                          • 10. Re: Re: Is there a way to configure jms request working on another server
                            mike just Master

                            Thanks so much, Justin.

                            I have followed the user guide on hornetq bridge

                            http://docs.jboss.org/hornetq/2.3.0.CR1/docs/user-manual/html/core-bridges.html

                             

                            but it only describes simple examples on the divert and bridge settings, as below.

                             

                            <diverts>
                              <divert name="test-divert">
                                    <address>queue/com.demo.test1</address>
                                    <forwarding-address>queue/com.demo.test2</forwarding-address>
                                    <exclusive>true</exclusive>
                                </divert>
                            </diverts>
                            <bridges>
                              <bridge name="test-bridge">
                                    <queue-name>queue/com.demo.test1</queue-name>
                                    <forwarding-address>queue/com.demo.test2</forwarding-address>
                                    <retry-interval>1000</retry-interval>
                                    <retry-interval-multiplier>1.0</retry-interval-multiplier>
                                    <reconnect-attempts>-1</reconnect-attempts>
                                    <use-duplicate-detection>true</use-duplicate-detection>
                                    <confirmation-window-size>10000000</confirmation-window-size>
                                    <static-connectors>
                                        <connector-ref>netty</connector-ref>
                                    </static-connectors>
                              </bridge>
                            </bridges>
                            

                             

                            Are these correct and enough? As I unders queue "queue/com.demo.test1" will be forwarded to queue "queue/com.demo.test2" locally, and I have confirmed this indeed works. but I have no idea how to forward this queue to another server. I know it is done by bridge and I have added the bridge configuration in my standalone.xml in server1, but I do not know what is next? How will the connector-ref "netty" do for the bridge? Anything needs to be done in my code? Anything needs to configue in server2 standalone.xml? Please advise.

                            • 11. Re: Re: Re: Is there a way to configure jms request working on another server
                              Justin Bertram Master

                              If you want to move the message to another server then you should use a connector that points to that server.  As the documentation states:

                               

                              The static-connectors is a list of connector-ref elements pointing to connector elements defined elsewhere. A connector encapsulates knowledge of what transport to use (TCP, SSL, HTTP etc) as well as the server connection parameters (host, port etc). For more information about what connectors are and how to configure them, please see Chapter 16, Configuring the Transport.

                              1 of 1 people found this helpful
                              • 12. Re: Re: Re: Re: Is there a way to configure jms request working on another server
                                mike just Master

                                Thanks so much, Justin. I have just made it work! but only once..Then I modified some setting and it will not work forever.. I can not see where I have made it wrong. Can you help do a check for me?

                                 

                                This is configuration for server1 which wants to connect to server2:

                                  <diverts>
                                     <divert name="test-divert">
                                                        <address>queue/com.demo.testQueue</address>
                                                        <forwarding-address>queue/com.demo.testQueue1</forwarding-address>
                                                        <exclusive>true</exclusive>
                                                    </divert>
                                  </diverts>
                                  <bridges>
                                     <bridge name="test-bridge">
                                                        <queue-name>queue/com.demo.testQueue1</queue-name>
                                                        <forwarding-address>queue/com.demo.testQueue2</forwarding-address>
                                                        <retry-interval>1000</retry-interval>
                                                        <retry-interval-multiplier>1.0</retry-interval-multiplier>
                                                        <reconnect-attempts>-1</reconnect-attempts>
                                                        <use-duplicate-detection>true</use-duplicate-detection>
                                                        <confirmation-window-size>10000000</confirmation-window-size>
                                                        <static-connectors>
                                                            <connector-ref>remote-connector</connector-ref>
                                                        </static-connectors>
                                                    </bridge>
                                                </bridges>
                                                <connectors>
                                                    <netty-connector name="netty" socket-binding="messaging"/>
                                                    <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                                                        <param key="batch-delay" value="50"/>
                                                    </netty-connector>
                                                    <in-vm-connector name="in-vm" server-id="0"/>
                                                    <connector name="remote-connector">
                                                        <factory-class>
                                                              org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                                                        </factory-class>
                                                         <param key="host" value="localhost"/>
                                                        <param key="port" value="5446"/>
                                                    </connector>
                                                </connectors>
                                

                                 

                                Configuration for server2 which is accepting requests from server1:

                                <connectors>
                                                    <netty-connector name="netty" socket-binding="messaging"/>
                                                    <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                                                        <param key="batch-delay" value="50"/>
                                                    </netty-connector>
                                                    <in-vm-connector name="in-vm" server-id="0"/>
                                                 <connector name="remote-connector">
                                                        <factory-class>
                                                              org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                                                        </factory-class>
                                                    </connector>
                                                </connectors>
                                                <acceptors>
                                                    <netty-acceptor name="netty" socket-binding="messaging"/>
                                                    <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
                                                        <param key="batch-delay" value="50"/>
                                                        <param key="direct-deliver" value="false"/>
                                                    </netty-acceptor>
                                                    <in-vm-acceptor name="in-vm" server-id="0"/>
                                                    <acceptor name="remote-connector">
                                                        <factory-class>
                                                             org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory
                                                        </factory-class>
                                                        <param key="host" value="localhost"/>
                                                        <param key="port" value="5446"/>
                                                    </acceptor>
                                                </acceptors>
                                

                                And the queue name on server2 has been configured to testQueue2 which is defined in server1's bridge forwarding address.

                                <jms-queue name="queue/com.demo.testQueue2">
                                     <entry name="queue/com.demo.testQueue2"/>
                                </jms-queue>
                                

                                 

                                And the connection factory used on server2 has been changed to the "remote-connector"

                                <pooled-connection-factory name="hornetq-ra">
                                                        <transaction mode="xa"/>
                                                        <connectors>
                                                            <connector-ref connector-name="remote-connector"/>
                                                        </connectors>
                                                        <entries>
                                                            <entry name="java:/JmsXA"/>
                                                        </entries>
                                                    </pooled-connection-factory>
                                </jms-connection-factories>
                                

                                 

                                I can confirm I have made it work once after following the hornetq user manual, but then it never worked again after I messed up with testing different changes. I have tried to rollback to which version I have made it work but strangely could not.

                                If you have a chance, can you help check where could be the problem? I may be too dull to debug configuration stuff...

                                • 13. Re: Re: Re: Re: Re: Is there a way to configure jms request working on another server
                                  Justin Bertram Master

                                  Since you're using "core" artifacts to work with JMS queues then you need to prefix your queue/address names with "jms.queue.", e.g.:

                                   

                                  <diverts>
                                    <divert name="test-divert"> 
                                        <address>jms.queue.queue/com.demo.testQueue</address> 
                                        <forwarding-address>jms.queue.queue/com.demo.testQueue1</forwarding-address> 
                                        <exclusive>true</exclusive> 
                                    </divert> 
                                  </diverts> 
                                  <bridges> 
                                    <bridge name="test-bridge"> 
                                        <queue-name>jms.queue.queue/com.demo.testQueue1</queue-name> 
                                        <forwarding-address>jms.queue.queue/com.demo.testQueue2</forwarding-address> 
                                        <retry-interval>1000</retry-interval> 
                                        <retry-interval-multiplier>1.0</retry-interval-multiplier> 
                                        <reconnect-attempts>-1</reconnect-attempts> 
                                        <use-duplicate-detection>true</use-duplicate-detection> 
                                        <confirmation-window-size>10000000</confirmation-window-size> 
                                        <static-connectors> 
                                          <connector-ref>remote-connector</connector-ref> 
                                        </static-connectors> 
                                    </bridge> 
                                  </bridges> 
                                  

                                   

                                  Read more about JMS-to-core mapping at http://docs.jboss.org/hornetq/2.3.0.Final/docs/user-manual/html/jms-core-mapping.html.

                                   

                                  Also, based on your configuration it looks like both servers are running on the same host (i.e. localhost).  Is that correct?

                                   

                                  Lastly, there's no reason to change the <pooled-connection-factory> on "server2" unless there's something about your use-case that I don't understand.

                                  • 14. Re: Re: Re: Re: Re: Is there a way to configure jms request working on another server
                                    mike just Master

                                    Thanks, Justin.

                                     

                                    Correct, I am running the two servers on same host. I will try with your suggestion.

                                     

                                    But I am a little confused about the queue name. Why is it working fine for each server without the prefix "jms.queue." when I did not add configuration of divert and bridge?

                                    1 2 3 Previous Next