0 Replies Latest reply on Dec 27, 2001 8:40 AM by Rajesh

    how session is used in  MDB

    Rajesh Newbie

      Hi,
      i have an application which sends message to MDB. MDB in turn calls session for request processing. After returning from session call MDB post result to queue ("output"). We are declaring session as static private variable : (this code snippet give only required details)

      public class MDBTest implements MessageDrivenBean, MessageListener
      {
      private static QueueSession session=null;

      ejbCreate()
      {
      session = tc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      }
      onMessage()
      {
      pub1 = session.createSender(queue);
      }
      }
      Every thing works fine. But i have some doubt how this single session is used by all instances?
      Does every instance of MDB creates its own session? (variable is private and static so it can be used by other instances also.) But i think one session cannot be used by more than one instance. (As per JMS specification one session can not be used more than one user)

      can anybody throw some light on use of session object in MDB.

      Thanks & Regards,
      Rajesh