You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jo...@apache.org on 2010/04/16 21:37:32 UTC

svn commit: r935058 - /qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java

Author: jonathan
Date: Fri Apr 16 19:37:31 2010
New Revision: 935058

URL: http://svn.apache.org/viewvc?rev=935058&view=rev
Log:
Simplifying with Rajith's help

Modified:
    qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java

Modified: qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java?rev=935058&r1=935057&r2=935058&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java (original)
+++ qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/hello/Hello.java Fri Apr 16 19:37:31 2010
@@ -27,8 +27,6 @@ import java.util.Properties;
 
 
 public class Hello {
-    private static final String CLASS = "Hello";
-
 
     public Hello() {
     }
@@ -51,6 +49,7 @@ public class Hello {
                     e.printStackTrace();
                 }
             });
+            connection.start();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
             Destination destination = (Destination) context.lookup("topicExchange");
@@ -62,18 +61,12 @@ public class Hello {
             messageProducer.send(message);
 
             message = messageConsumer.receive();
-            if (message instanceof TextMessage) {
-                String text = ((TextMessage) message).getText();
-                System.out.println(text);
-            } else {
-                System.out.println("Ooops, not a TextMessage!");
-            }
+            System.out.println(message.getText());
 
             connection.close();
             context.close();
         }
         catch (Exception exp) {
-            System.err.println(CLASS + ": Caught an Exception: " + exp);
             exp.printStackTrace();
         }
     }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org