9 Replies Latest reply on Oct 15, 2010 4:51 PM by Clebert Suconic

    ClientSessionFactory questions

    Karl Hennig Newbie

      Hi, I expect to have a high volume of message throughput from producers and have some questions about how sessions and connections are used.  If I create a session factory as follows:

       

      factory = new ClientSessionFactoryImpl(
                                                  new TransportConfiguration(
                                                      "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory", connectionParams));

       

      Is this factory backed by a single connection to the broker?  Can I create multiple sessions simultaneously?

       

      ClientSession session1 = factory.createSession(true, false, false, false);
      ClientSession session2 = factory.createSession(true, false, false, false);

      ClientSession session3 = factory.createSession(true, false, false, false);

      ClientProducer producer = session1.createProducer(queue);

      ClientProducer producer = session2.createProducer(queue);

      ClientProducer producer = session3.createProducer(queue);

      //create messages and send for each producer

      //close sessions

       

      Writing it like this seems strange but I will have a multithreaded environment and need to know if the factories can be used in this manner.  I saw Tim reverted support for session multiplexing, so I don't know what exactly I can do in place of that.  Due to the nature of the messages, I cannot batch them up and send all at once.

       

      Please help me understand how a factory is backed -- by one connection, multiple connections, one session, multiple sessions, etc.  Thank you!

       

      Karl