Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 52870 invoked from network); 3 Dec 2007 15:07:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2007 15:07:32 -0000 Received: (qmail 99894 invoked by uid 500); 3 Dec 2007 15:07:01 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 99886 invoked by uid 500); 3 Dec 2007 15:07:01 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 99871 invoked by uid 99); 3 Dec 2007 15:07:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 07:07:01 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 15:06:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 400741A9832; Mon, 3 Dec 2007 07:06:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r600561 - in /incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse: MessageMirror.java P2PRequestor.java PubSubRequestor.java Date: Mon, 03 Dec 2007 15:06:51 -0000 To: qpid-commits@incubator.apache.org From: arnaudsimon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071203150652.400741A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: arnaudsimon Date: Mon Dec 3 07:06:51 2007 New Revision: 600561 URL: http://svn.apache.org/viewvc?rev=600561&view=rev Log: Updated ofr converting request text in upercase text Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/MessageMirror.java incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/P2PRequestor.java incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/PubSubRequestor.java Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/MessageMirror.java URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/MessageMirror.java?rev=600561&r1=600560&r2=600561&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/MessageMirror.java (original) +++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/MessageMirror.java Mon Dec 3 07:06:51 2007 @@ -142,8 +142,6 @@ // Print out the details of the just received message System.out.println(CLASS + ": Message received:"); - System.out.println("\tID=" + requestMessage.getJMSMessageID()); - System.out.println("\tCorrelationID=" + requestMessage.getJMSCorrelationID()); if (requestMessage instanceof TextMessage) { @@ -160,11 +158,11 @@ { System.out.println("Activating response queue listener for: " + destination); responseMessage = - session.createTextMessage("Activating response queue listener for: " + destination); - String correlationID = requestMessage.getJMSCorrelationID(); - if (correlationID != null) + session.createTextMessage(); + if (requestMessage instanceof TextMessage) { - responseMessage.setJMSCorrelationID(correlationID); + responseMessage.setText(((TextMessage) requestMessage).getText().toUpperCase()); + System.out.println("\tResponse = " + responseMessage.getText()); } messageProducer = session.createProducer(requestMessage.getJMSReplyTo()); messageProducer.send(responseMessage); Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/P2PRequestor.java URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/P2PRequestor.java?rev=600561&r1=600560&r2=600561&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/P2PRequestor.java (original) +++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/P2PRequestor.java Mon Dec 3 07:06:51 2007 @@ -107,42 +107,19 @@ // Create a message to send as a request for service TextMessage request; - request = session.createTextMessage("\"Twas brillig, and the slithy toves\",\n" + - "\t\t\"Did gire and gymble in the wabe.\",\n" + - "\t\t\"All mimsy were the borogroves,\",\n" + - "\t\t\"And the mome raths outgrabe.\""); + request = session.createTextMessage(); - // Declare a message to be used for receiving any response - Message response; - - // Get the number of times that this sample should request service + // Get the number of times that this sample should request service for (int i = 0; i < getNumberMessages(); i++) { - /** - * Set a message correlation value. This is not strictly required it is - * just an example of how messages requests can be tied together. - */ - request.setJMSCorrelationID("Message " + i); - System.out.println(CLASS + ": Sending request " + i); - - response = requestor.request(request); - - // Print out the details of the message sent - System.out.println(CLASS + ": Message details of request"); - System.out.println("\tID = " + request.getJMSMessageID()); - System.out.println("\tCorrelationID = " + request.getJMSCorrelationID()); - System.out.println("\tContents= " + ((TextMessage)request).getText()); - - // Print out the details of the response received - System.out.println(CLASS + ": Message details of response"); - System.out.println("\tID = " + response.getJMSMessageID()); - System.out.println("\tCorrelationID = " + response.getJMSCorrelationID()); - if (response instanceof TextMessage) - { - System.out.println("\tContents= " + ((TextMessage) response).getText()); - } - - System.out.println(); + request = session.createTextMessage("Twas brillig, and the slithy toves"); + sendReceive(request, requestor); + request = session.createTextMessage("Did gire and gymble in the wabe"); + sendReceive(request, requestor); + request = session.createTextMessage("All mimsy were the borogroves,"); + sendReceive(request, requestor); + request = session.createTextMessage("And the mome raths outgrabe."); + sendReceive(request, requestor); } //send the final message for ending the mirror @@ -162,6 +139,18 @@ catch (Exception exp) { System.err.println(CLASS + ": Caught an Exception: " + exp); + } + } + + private void sendReceive(TextMessage request, QueueRequestor requestor) throws JMSException + { + Message response; + response = requestor.request(request); + System.out.println("\tRequest Contents= " + request.getText()); + // Print out the details of the response received + if (response instanceof TextMessage) + { + System.out.println("\t Response Contents= " + ((TextMessage) response).getText()); } } } Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/PubSubRequestor.java URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/PubSubRequestor.java?rev=600561&r1=600560&r2=600561&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/PubSubRequestor.java (original) +++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/requestResponse/PubSubRequestor.java Mon Dec 3 07:06:51 2007 @@ -105,38 +105,19 @@ // Create a message to send as a request for service TextMessage request; - request = session.createTextMessage( - "\"Twas brillig, and the slithy toves\",\n" + "\t\t\"Did gire and gymble in the wabe.\",\n" + "\t\t\"All mimsy were the borogroves,\",\n" + "\t\t\"And the mome raths outgrabe.\""); - - // Declare a message to be used for receiving any response - Message response; + request = session.createTextMessage(); // Get the number of times that this sample should request service for (int i = 0; i < getNumberMessages(); i++) { - /** - * Set a message correlation value. This is not strictly required it is - * just an example of how messages requests can be tied together. - */ - request.setJMSCorrelationID("Message " + i); - System.out.println(CLASS + ": Sending request " + i); - - response = requestor.request(request); - - // Print out the details of the message sent - System.out.println(CLASS + ": Message details of request"); - System.out.println("\tID = " + request.getJMSMessageID()); - System.out.println("\tCorrelationID = " + request.getJMSCorrelationID()); - System.out.println("\tContents= " + ((TextMessage) request).getText()); - - // Print out the details of the response received - System.out.println(CLASS + ": Message details of response"); - System.out.println("\tID = " + response.getJMSMessageID()); - System.out.println("\tCorrelationID = " + response.getJMSCorrelationID()); - if (response instanceof TextMessage) - { - System.out.println("\tContents= " + ((TextMessage) response).getText()); - } + request = session.createTextMessage("Twas brillig, and the slithy toves"); + sendReceive(request, requestor); + request = session.createTextMessage("Did gire and gymble in the wabe"); + sendReceive(request, requestor); + request = session.createTextMessage("All mimsy were the borogroves,"); + sendReceive(request, requestor); + request = session.createTextMessage("And the mome raths outgrabe."); + sendReceive(request, requestor); } // And send a final message to indicate termination. request.setText("That's all, folks!"); @@ -154,6 +135,18 @@ catch (Exception exp) { System.err.println(CLASS + ": Caught an Exception: " + exp); + } + } + + private void sendReceive(TextMessage request, TopicRequestor requestor) throws JMSException + { + Message response; + response = requestor.request(request); + System.out.println("\tRequest Contents= " + request.getText()); + // Print out the details of the response received + if (response instanceof TextMessage) + { + System.out.println("\t Response Contents= " + ((TextMessage) response).getText()); } } }