Package javax.jms

Examples of javax.jms.QueueRequestor


   public void testQueueRequestor() throws Exception
   {
      // Set up the requestor
      QueueConnection conn1 = cf.createQueueConnection();
      QueueSession sess1 = conn1.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      QueueRequestor requestor = new QueueRequestor(sess1, queue);
      conn1.start();
     

      // And the responder
      QueueConnection conn2 = cf.createQueueConnection();
      QueueSession sess2 = conn2.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      TestMessageListener listener = new TestMessageListener(sess2);
      QueueReceiver receiver = sess2.createReceiver(queue);
      receiver.setMessageListener(listener);
      conn2.start();
     
      Message m1 = sess1.createMessage();
      log.trace("Sending request message");
      TextMessage m2 = (TextMessage)requestor.request(m1);
     
     
      assertNotNull(m2);
     
      assertEquals("This is the response", m2.getText());
View Full Code Here


      serverThread.start();

      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue) context.lookup(TEST_QUEUE);

      QueueRequestor queueRequestor = new QueueRequestor(session, queue);
      TextMessage message = session.createTextMessage();
      message.setText("Request Test");

      for (int i = 0; i < 5; i++)
      {

         getLog().debug("Making client request #" + i);
         TextMessage reply = (TextMessage) queueRequestor.request(message);
         String replyID = new String(reply.getJMSCorrelationID());
         if (!replyID.equals(message.getJMSMessageID()))
            throw new Exception("REQUEST: ERROR: Reply does not match sent message");

      }

      getLog().debug("Making client request to shut server down.");
      message.setText("Quit");
      queueRequestor.request(message);

      serverThread.join();
      disconnect();

      getLog().debug("RequestReplyQueue passed");
View Full Code Here

     * @param destination
     *            the queue to send the message on
     * @throws JMSException
     */
    public TemporaryQueueExecutor(QueueSession session, Queue destination) throws JMSException {
        requestor = new QueueRequestor(session, destination);
    }
View Full Code Here

      try
      {

         conn1 = JMSTestCase.cf.createQueueConnection();
         QueueSession sess1 = conn1.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         QueueRequestor requestor = new QueueRequestor(sess1, HornetQServerTestCase.queue1);
         conn1.start();

         // And the responder
         conn2 = JMSTestCase.cf.createQueueConnection();
         QueueSession sess2 = conn2.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         TestMessageListener listener = new TestMessageListener(sess2);
         QueueReceiver receiver = sess2.createReceiver(HornetQServerTestCase.queue1);
         receiver.setMessageListener(listener);
         conn2.start();

         Message m1 = sess1.createMessage();
         log.trace("Sending request message");
         TextMessage m2 = (TextMessage)requestor.request(m1);
         ProxyAssertSupport.assertNotNull(m2);

         ProxyAssertSupport.assertEquals("This is the response", m2.getText());
      }
      finally
View Full Code Here

    requestServerConsumer = requestServerSession.createConsumer(theQueue);
    requestServerProducer = requestServerSession.createProducer(null);

    QueueSession session = localConnection.createQueueSession(false,
        Session.AUTO_ACKNOWLEDGE);
    requestor = new QueueRequestor(session, theQueue);
  }
View Full Code Here

     * @param destination
     *            the queue to send the message on
     * @throws JMSException
     */
    public TemporaryQueueExecutor(QueueSession session, Queue destination) throws JMSException {
        requestor = new QueueRequestor(session, destination);
    }
View Full Code Here

        requestServerConsumer = requestServerSession.createConsumer(theQueue);
        requestServerConsumer.setMessageListener(this);
        requestServerProducer = requestServerSession.createProducer(null);

        QueueSession session = remoteConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        requestor = new QueueRequestor(session, theQueue);
    }
View Full Code Here

        requestServerConsumer = requestServerSession.createConsumer(theQueue);
        requestServerConsumer.setMessageListener(this);
        requestServerProducer = requestServerSession.createProducer(null);
       
        QueueSession session = remoteConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
        requestor = new QueueRequestor(session,theQueue);
    }
View Full Code Here

            /* Create a session for the requestor */
            s_send = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            /* Create a session for the receiver */
            s_rec = qc.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
            new ReplyThread(s_rec, q);
            QueueRequestor requestor = new QueueRequestor(s_send, q);
            Message msg = s_send.createObjectMessage("hello");
            Message rec = requestor.request(msg);

            Assert.assertEquals("requested message", "hello", ((ObjectMessage)rec).getObject());

            requestor.close();

        } finally {
            try { s_rec.close()} catch(Exception ex) {}
            try { s_send.close(); } catch(Exception ex) {}
            try { qc.close();     } catch(Exception ex) {}
View Full Code Here

            QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
            queConn = qcf.createQueueConnection();
            queConn.start();
            session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
            Queue queue = (Queue) ctx.lookup("queue/A");
            requestor = new QueueRequestor(session, queue);
         }
         // Send the invocation via jms
         Message msg = session.createObjectMessage(invocation.getArguments());
         msg.setStringProperty("ejbName", "BusinessSession");
         ObjectMessage replyMsg = (ObjectMessage) requestor.request(msg);
View Full Code Here

TOP

Related Classes of javax.jms.QueueRequestor

Copyright © 2018 www.massapicom. 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.