0 Replies Latest reply on Aug 19, 2005 5:13 PM by jason1

    Options for connecting and sending messages from EJBs

    jason1 Newbie

      I'm considering options to scale JMS message sending inside a high-volume messaging J2EE application. I want to prevent connecting/disconnecting each time I send a message to save time. I also want to ensure the transactional nature of my messages is not affected. So here are some options. Any idea which is best to use?

      Option1 : New Connection, New Session
      Each time a message is sent, a new Connection is made and from it, a new Session is created. Each is closed after sending the message.

      Option2: Reuse existing Connection, New Session
      This option creates a Connection in a singleton or MBean that the whole J2EE application shares to create new Sessions from. Each time a message is sent, a new Session is created from the Connection and then the Session is closed after sending the message. The Connection is not closed until JBoss shuts down or fails over to another HA JBossMQ server.

      Option3: Reuse existing Connection, Reuse Session
      This option creates a Connection in a singleton or MBean. The 1 Connection creates a single Session from which ALL messages are created when a message needs to be sent. They are not closed until JBoss shuts down or fails over to another HA JBossMQ server.

      Comments on other options I missed?

      thanks!