1 2 3 Previous Next 34 Replies Latest reply on Nov 2, 2012 4:16 AM by adryen31 Go to original post
      • 30. Re: How to dissociate 4 HornetQ in same Tomcat
        adryen31

        Ok

        for client session factory, how I can witch this:

        TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName());

        final ServerLocator serverLocator = HornetQClient.createServerLocatorWithHA(tc);

        this.clientSessionFactory = serverLocator.createSessionFactory();

        this.clientProducerSession = this.clientSessionFactory.createSession();

        this.clientProducer = this.clientProducerSession.createProducer();

         

        By only provided my hornetq-configuration.xml file ?

        for example:

         

        URL scfpURL = Class.forName("com.webapp.MyClass").getResource("/META-INF/hornetq-configuration.xml);

        FileConfiguration configuration;

        configuration.setConfigurationUrl(scfpURL.toURI().toString());

        HornetQClient.createServerLocatorWithHA(configuration)

         

        One method like HornetQClient.createServerLocatorWithHA(configuration) exist ?

        • 31. Re: How to dissociate 4 HornetQ in same Tomcat
          ataylor

          i still have no idea what you are asking. however to create a session factory just configure it with the TransportConfiguration that reflects your hornetq configuration.

          • 32. Re: How to dissociate 4 HornetQ in same Tomcat
            adryen31

            But how I can create a session factory which reflect my hornetq configuration file ? It's this I want to do

            • 33. Re: How to dissociate 4 HornetQ in same Tomcat
              ataylor

              TransportConfiguration tc = new TransportConfiguration(put in here what ever my hq configuration is);

              final ServerLocator serverLocator = HornetQClient.createServerLocatorWithHA(tc);

              • 34. Re: How to dissociate 4 HornetQ in same Tomcat
                adryen31

                Great thank for your patience and your help, I have use invm connector, but I have a last question that intrigue me. I have configured on my each application:

                 

                <connector name="my-connector">

                        <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>

                         <param key="server-id" value="${hornetq.server-id:0}"/>

                      </connector>

                  <acceptor name="my-acceptor">

                         <factory-class>

                               org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory

                           </factory-class>

                           <param key="server-id" value="0"/>

                </acceptor>

                 

                I thought I will have to configure for each application one different server-id like:

                 

                     in webapp 1]

                           <param key="server-id" value="0"/>

                          <param key="server-id" value="${hornetq.server-id:0}"/>

                 

                     in webapp 2]

                           <param key="server-id" value="1"/>

                          <param key="server-id" value="${hornetq.server-id:1}"/>

                 

                     in webapp 3]

                           <param key="server-id" value="2"/>

                          <param key="server-id" value="${hornetq.server-id:2}"/>

                 

                 

                But to try to see what happens if I launch my 3 webapp with the same server id (thinking that was going to say the same id was used), I have

                configured the same server id on each webapp server-id 0. Because my 3 webapp are executed in same Tomcat (and same JVM I think), I  thought it could be a problem.

                But I send a message with one webapp, the other two don't receive it (this is the behavior I wanted), but what is due this behavior?

                They did not share posts knowing they have the same id and the same server addresses where messages are sent?

                 

                Because for me the term "in-vm", could mean that they cannot have the same identifier server if they are executed in the same JVM

                 

                Thank you again for your help

                1 2 3 Previous Next