Examples of QueueRequestor


Examples of javax.jms.QueueRequestor

         // Step 7. Create a JMS queue session with AUTO_ACKNOWLEDGE mode
         QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

         // Step 8. Create a JMS queue requestor to send requests to the queue
         QueueRequestor queueRequestor = new QueueRequestor(session, queue);

         // Step 9. Create a JMS message to send as a request
         TextMessage request = session.createTextMessage("Hello, World!");

         // Step 10. Use the requestor to send the request and wait to receive a reply
         TextMessage reply = (TextMessage)queueRequestor.request(request);

         // Step 11. The reply's text contains the reversed request's text
         System.out.println("Send request: " + request.getText());
         System.out.println("Received reply:" + reply.getText());

         // Step.12 close the queue requestor
         queueRequestor.close();

         // Step 13. close the text reverser service
         reverserService.close();

         return true;
View Full Code Here

Examples of javax.jms.QueueRequestor

        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
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.