2 Replies Latest reply on Sep 13, 2007 5:03 PM by Neeraj khadakkar

    Configuring Destinations in MDB's

    Neeraj khadakkar Newbie

      JBoss Messaging 1.3/ JBoss AS (4.2.1)

      We have an incoming message Queue and a pool of MDB's listening. The MDB's process the data and have to post results onto another Queue. This is the code for the posting to the reply Queue:

      @Resource(mappedName = "java:/JmsXA")
      private static QueueConnectionFactory factory;
      
      @Resource(mappedName = "/queue/ResolvedUniversalResourceQueue")
      private static Queue destinationReply;
      
      public void onMessage( Message msg)
       {
       // Process incoming msg and get it ready to be sent outward
       //
       //
       qConnection = factory.createQueueConnection();
       QueueSession qSession = qConnection.createQueueSession( false, Session.DUPS_OK_ACKNOWLEDGE);
       QueueSender qSender = qSession.createSender( destinationReply);
       qSender.send( qSession.createObjectMessage( urimsg));
       qSender.close();
      }
      


      a. Is it ok to create new QueueConnections every time ? Especially since i use the java:/JMSXA connection factory ?
      b. Is it ok to create Sessions and QueueSender every single invoke ?

      Is there any best practice for pooling/sharing Sessions and QueueSender ?