1 2 3 Previous Next 34 Replies Latest reply on Nov 2, 2012 4:16 AM by adrien ruffie

    How to dissociate 4 HornetQ in same Tomcat

    adrien ruffie Newbie

      Hello all,

       

      my problem is I have 4 applications with each one its own org.hornetq.core.server.HornetQServer

      But When I publish a message in one application, the 3 others received the published message ...

      Why ? Because 4 applications are in the same tomcat ? How I can dissociate each one ?

       

      I use following line to instanciate my HornetQServer:

       

      this.messagingServer = HornetQServers.newHornetQServer(this.configuration);

       

      I have found this is hornetq documentation:

       

      HornetQServers is a factory class for instantiating HornetQServer instances. This class should be used when you want to instantiate a HornetQServer instance for embedding in your own application, as opposed to directly instantiating an implementing instance.

       

      My configuration file of hornetq is in attachment.

       

      so if I'm not mistaken each server must be dissociated from other ?

       

      Any one have an idea ?

       

      Best regards,

       

      Adryen31

        • 1. Re: How to dissociate 4 HornetQ in same Tomcat
          Andy Taylor Master

          im not sure what you mean by disacotiate, each hornetq will be crated distinct of the other, you will have to give us more info if you want some help.

          is there a reason you need 4 hornetq servers, why dont you just deploy one and use different destinations for each app, that would make more sense.

          1 of 1 people found this helpful
          • 2. Re: How to dissociate 4 HornetQ in same Tomcat
            adrien ruffie Newbie

            Thank Andy,

             

            I can deploy just one hornetq for the 4 webapps, because each webapps package one hornetq ...

            I means by dissociate: 1 webapp publish one message on own hornetq, but the result that

            each other webapp (with each own hornetq instance) get also the same message ...

             

            perhaps because each hornetq-configuration.xml have same connector and acceptor:

             

            <connectors>

                  <connector name="netty">

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

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

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

                  </connector>

                 

                  <connector name="netty-throughput">

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

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

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

                     <param key="batch-delay" value="50"/>

                  </connector>

               </connectors>

             

             

               <acceptors>

                  <acceptor name="netty">

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

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

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

                  </acceptor>

                 

                  <acceptor name="netty-throughput">

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

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

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

                     <param key="batch-delay" value="50"/>

                     <param key="direct-deliver" value="false"/>

                  </acceptor>

               </acceptors>

            • 3. Re: How to dissociate 4 HornetQ in same Tomcat
              Andy Taylor Master

              obviously each server would need to be configured to use a different port. I cant see the point tho in deploying a whole server for each app, it doesnt really make sense. deploy 1 server and then all apps can use it.

              1 of 1 people found this helpful
              • 4. Re: How to dissociate 4 HornetQ in same Tomcat
                adrien ruffie Newbie

                Thank Andy, I will try with 4 acceptor/connector different ports. I know, most infrastructure should be 1 server and all apps use it, but it's an already existing infrastructure which should not be modified ...

                • 5. Re: How to dissociate 4 HornetQ in same Tomcat
                  adrien ruffie Newbie

                  Hello Andy,

                   

                  I have try with 4 following attached hornetq-configuration files and my messages continue to be published on 4 different instances ...

                  more which is weird, when I look listen/etablished server port following line were displayed (netstat command):

                   

                  tcp6 0 0 localhost:5443 [::]:* LISTEN

                  tcp6 0 0 localhost:5445 [::]:* LISTEN

                  tcp6 0 0 localhost:5447 [::]:* LISTEN

                  tcp6 0 0 localhost:5449 [::]:* LISTEN

                  tcp6 0 0 localhost:5453 [::]:* LISTEN

                  tcp6 0 0 localhost:5455 [::]:* LISTEN

                  tcp6 0 0 localhost:5457 [::]:* LISTEN

                  tcp6 0 0 localhost:5459 [::]:* LISTEN

                   

                   

                  En revanche je n'ai que :

                  tcp6 0 0 localhost:5445 localhost:54378 ESTABLISHED

                  tcp6 0 0 localhost:5445 localhost:38851 ESTABLISHED

                  tcp6 0 0 localhost:5445 localhost:38861 ESTABLISHED

                  • 6. Re: How to dissociate 4 HornetQ in same Tomcat
                    Andy Taylor Master

                    to be honest, I have no idea, what tomcat/spring is doing. If tou can provide me with an example project i can use to build/run your examples i could take a look. or you could debug it yourself. I cant see how the same message can be sent to multiple servers tho.

                    • 7. Re: How to dissociate 4 HornetQ in same Tomcat
                      adrien ruffie Newbie

                      I don't know why it behaves as this, but you think it may come from tomcat ?

                      hornetq at no time can share their configuration or ports?

                       

                      I very difficult for me to provide my project because, it's my enterprise webapp ... and it isn't open source

                       

                      I seach on tomcat side, for the moment

                      • 8. Re: How to dissociate 4 HornetQ in same Tomcat
                        Andy Taylor Master

                        we have lots of tests that do this, start lots of servers, unl;ess you have some sort of weird mis configuration i cant see it happening, or maybe you are just mis reading what you are seeing.

                         

                        I doubt the tomcat guys can help you unless your more specific with your problem, cant you just write a simple example that does something similar to your app

                        • 9. Re: How to dissociate 4 HornetQ in same Tomcat
                          adrien ruffie Newbie

                          I think I have found the problem but not sure ...

                          Imagine all my applications send

                           

                           

                                                                  this.clientProducer.send(address, clientMessage);

                           

                          with address = "myAddress"

                           

                          but all of each have "MyAddress" and not "MyAddress1", "MyAddress2", "MyAddress3", "MyAddress4"

                          Each address must be unique ? Even if each hornetq configuration file have not same port, and journal,page,binding-directory ...

                          they share the same address publication?

                          • 10. Re: How to dissociate 4 HornetQ in same Tomcat
                            Andy Taylor Master

                            the only way that can happen is if somehow you have made your servers form a cluster

                            • 11. Re: How to dissociate 4 HornetQ in same Tomcat
                              adrien ruffie Newbie

                              Yes that's what I thought but I have this for each application ...

                               

                              INFO: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\res\hornetq\journal,bindingsDirectory=C:\res\hornetq\bindings,largeMessagesDirectory=C:\res\hornetq\large-messages,pagingDirectory=C:\res\hornetq\paging)

                               

                              I have investigate, if in the first application I send a message to "myaddress" all MessageHandler of the 4 applications receive the message ...

                              • 12. Re: How to dissociate 4 HornetQ in same Tomcat
                                Andy Taylor Master

                                are all your servers using the same journal? if so this is wrong, each server should use their own journal

                                • 13. Re: How to dissociate 4 HornetQ in same Tomcat
                                  adrien ruffie Newbie

                                  Conf 1:

                                   

                                  <paging-directory>/var/webapps/formation/hornetq/paging</paging-directory>

                                    

                                     <bindings-directory>/var/webapps/formation/hornetq/bindings</bindings-directory>

                                    

                                     <journal-directory>/var/webapps/formation/hornetq/journal</journal-directory>

                                   

                                  Conf 2:

                                   

                                  <paging-directory>/var/webapps/demo_master/hornetq/paging</paging-directory>

                                    

                                     <bindings-directory>/var/webapps/demo_master/hornetq/bindings</bindings-directory>

                                    

                                     <journal-directory>/var/webapps/demo_master/hornetq/journal</journal-directory>

                                   

                                   

                                  Conf 3:

                                   

                                    <paging-directory>/var/webapps/demo_backup/hornetq/paging</paging-directory>

                                    

                                     <bindings-directory>/var/webapps/demo_backup/hornetq/bindings</bindings-directory>

                                    

                                     <journal-directory>/var/webapps/demo_backup/hornetq/journal</journal-directory>

                                   

                                   

                                  Conf 4:

                                   

                                  <paging-directory>/var/webapps/ROOT/hornetq/paging</paging-directory>

                                    

                                     <bindings-directory>/var/webapps/ROOT/hornetq/bindings</bindings-directory>

                                    

                                     <journal-directory>/var/webapps/ROOT/hornetq/journal</journal-directory>

                                  • 14. Re: How to dissociate 4 HornetQ in same Tomcat
                                    Andy Taylor Master

                                    so thats a no then, well unless you can provide me something i can debug i cant really help you much more.

                                    1 2 3 Previous Next