Package javax.jms

Examples of javax.jms.QueueConnection.createQueueSession()


      // Get the ConnectionFactory from JNDI
      final QueueConnectionFactory factory = (QueueConnectionFactory) naimgContext.lookup(JNDI_NAME_CONNECTION_FACTORY);

      // Make a Connection
      final QueueConnection connection = factory.createQueueConnection();
      final QueueSession sendSession = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

      // Make the message
      final String contents = "Test Message Contents";
      final TextMessage message = sendSession.createTextMessage(contents);
View Full Code Here


      Queue queue = (Queue) getInitialContext().lookup(jndiName);
      assertNotNull(queue);
      QueueConnectionFactory qCf = (QueueConnectionFactory) getInitialContext().lookup("ConnectionFactory");
      QueueConnection c = qCf.createQueueConnection();
      c.start();
      QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      QueueSender sender = s.createSender(queue);
     
      // Message 1
      sender.send(s.createTextMessage("Hey!"));
View Full Code Here

   private void sendReply(Queue destination, String messageID) throws JMSException
   {
      QueueConnection conn = qFactory.createQueueConnection();
      try
      {
         QueueSession session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         QueueSender sender = session.createSender(destination);
         TextMessage message = session.createTextMessage("SUCCESS");
         message.setJMSCorrelationID(messageID);
         sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 500);
      }
View Full Code Here

   private void sendReply(Queue destination, String messageID, Exception e) throws JMSException
   {
      QueueConnection conn = qFactory.createQueueConnection();
      try
      {
         QueueSession session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         QueueSender sender = session.createSender(destination);
         ObjectMessage message = session.createObjectMessage(e);
         message.setJMSCorrelationID(messageID);
         sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 500);
      }
View Full Code Here

      QueueSession session = null;

      Queue queue = (Queue) getInitialContext().lookup("queue/mdbsessionpoolclearQueue");
      QueueConnectionFactory factory = getQueueConnectionFactory();
      cnn = factory.createQueueConnection();
      session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

      TextMessage msg = session.createTextMessage("Hello World " + new Date());

      sender = session.createSender(queue);
      sender.send(msg);
View Full Code Here

     
      //      numActiveSessions = (Integer)server.getAttribute(jmsContainerInvoker, "NumActiveSessions");
      //      assertEquals(1, numActiveSessions);
     
      cnn = factory.createQueueConnection();
      session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

      msg = session.createTextMessage("Hello World " + new Date());

      sender = session.createSender(queue);
     
View Full Code Here

      {
        QueueSession session1 = queueConnection1.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
        queue = (Queue)context.lookup(TEST_QUEUE);
        QueueReceiver receiver1 = session1.createReceiver(queue);
 
        QueueSession session2 = queueConnection2.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
        QueueReceiver receiver2 = session2.createReceiver(queue);
 
        queueConnection1.start();
        queueConnection2.start();
 
View Full Code Here

      queConn.start();
      MDBInvoker[] threads = new MDBInvoker[MAX_SIZE];
      for(int n = 0; n < MAX_SIZE; n ++)
      {
       // Each thread should own its own session, accordingly to the JMS spec
         QueueSession session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         MDBInvoker t = new MDBInvoker(session, queueA, queueB, n, done, getLog());
         threads[n] = t;
         t.start();
      }
      assertTrue("Acquired done", done.attempt(1500 * MAX_SIZE));
 
View Full Code Here

         queConn.start();

         Queue queueA = (Queue) ctx.lookup("queue/A");
         Queue queueB = (Queue) ctx.lookup("queue/B");
        
         session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         sender = session.createSender(queueA);
         receiver = session.createReceiver(queueB);

         while (receiver.receive(1000) != null)
         {
View Full Code Here

         queConn.start();

         Queue queueA = (Queue) ctx.lookup("queue/C");
         Queue queueB = (Queue) ctx.lookup("queue/D");

         session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
         sender = session.createSender(queueA);
         receiver = session.createReceiver(queueB);

         while (receiver.receive(1000) != null)
         {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.