activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1220908 - in /activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java: pom.xml src/main/java/example/Listener.java src/main/java/example/Publisher.java
Date Mon, 19 Dec 2011 19:25:18 GMT
Author: chirino
Date: Mon Dec 19 19:25:18 2011
New Revision: 1220908

URL: http://svn.apache.org/viewvc?rev=1220908&view=rev
Log:
Upgrade to version 1.6 of stompjms.

Modified:
    activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/pom.xml
    activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Listener.java
    activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Publisher.java

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/pom.xml?rev=1220908&r1=1220907&r2=1220908&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/pom.xml Mon
Dec 19 19:25:18 2011
@@ -36,10 +36,14 @@
   <dependencies>
     
     <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jms_1.1_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
       <groupId>org.fusesource.stompjms</groupId>
       <artifactId>stompjms-client</artifactId>
-      <version>1.3</version>
-      <classifier>uber</classifier>
+      <version>1.6</version>
     </dependency>
 
   </dependencies>

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Listener.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Listener.java?rev=1220908&r1=1220907&r2=1220908&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Listener.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Listener.java
Mon Dec 19 19:25:18 2011
@@ -16,9 +16,7 @@
  */
 package example;
 
-import org.fusesource.stompjms.StompJmsConnectionFactory;
-import org.fusesource.stompjms.StompJmsDestination;
-
+import org.fusesource.stomp.jms.*;
 import javax.jms.*;
 
 class Listener {
@@ -37,11 +35,11 @@ class Listener {
         Connection connection = factory.createConnection(user, password);
         connection.start();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        Destination dest = StompJmsDestination.createDestination(destination);
+        Destination dest = new StompJmsDestination(destination);
 
         MessageConsumer consumer = session.createConsumer(dest);
         long start = System.currentTimeMillis();
-        long count = 0;
+        long count = 1;
         System.out.println("Waiting for messages...");
         while(true) {
             Message msg = consumer.receive();
@@ -52,13 +50,18 @@ class Listener {
                     System.out.println(String.format("Received %d in %.2f seconds", count,
(1.0*diff/1000.0)));
                     break;
                 } else {
+                    if( count != msg.getIntProperty("id") ) {
+                        System.out.println("mismatch: "+count+"!="+msg.getIntProperty("id"));
+                    }
+                    count = msg.getIntProperty("id");
+
                     if( count == 0 ) {
                         start = System.currentTimeMillis();
                     }
-                    count ++;
                     if( count % 1000 == 0 ) {
                         System.out.println(String.format("Received %d messages.", count));
                     }
+                    count ++;
                 }
 
             } else {

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Publisher.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Publisher.java?rev=1220908&r1=1220907&r2=1220908&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Publisher.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/java/src/main/java/example/Publisher.java
Mon Dec 19 19:25:18 2011
@@ -16,9 +16,7 @@
  */
 package example;
 
-import org.fusesource.stompjms.StompJmsConnectionFactory;
-import org.fusesource.stompjms.StompJmsDestination;
-
+import org.fusesource.stomp.jms.*;
 import javax.jms.*;
 
 class Publisher {
@@ -46,12 +44,14 @@ class Publisher {
         Connection connection = factory.createConnection(user, password);
         connection.start();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        Destination dest = StompJmsDestination.createDestination(destination);
+        Destination dest = new StompJmsDestination(destination);
         MessageProducer producer = session.createProducer(dest);
         producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 
         for( int i=1; i <= messages; i ++) {
-            producer.send(session.createTextMessage(body));
+            TextMessage msg = session.createTextMessage(body);
+            msg.setIntProperty("id", i);
+            producer.send(msg);
             if( (i % 1000) == 0) {
                 System.out.println(String.format("Sent %d messages", i));
             }



Mime
View raw message