[jboss-cvs] JBoss Messaging SVN: r6232 - in trunk: examples/jms/durable and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 31 06:53:10 EDT 2009


Author: timfox
Date: 2009-03-31 06:53:10 -0400 (Tue, 31 Mar 2009)
New Revision: 6232

Modified:
   trunk/.classpath
   trunk/examples/jms/durable/readme.html
   trunk/examples/jms/durable/src/org/jboss/jms/example/DurableSubscriberExample.java
Log:
more tweaks to example

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2009-03-31 10:51:19 UTC (rev 6231)
+++ trunk/.classpath	2009-03-31 10:53:10 UTC (rev 6232)
@@ -4,8 +4,6 @@
 	<classpathentry kind="src" path="build/src"/>
 	<classpathentry kind="src" path="tests/config"/>
 	<classpathentry kind="src" path="src/config"/>
-	<classpathentry kind="src" path="examples/jms/src"/>
-	<classpathentry kind="src" path="examples/messaging/src"/>
 	<classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src">
 		<attributes>
 			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="trunk/native/bin"/>

Modified: trunk/examples/jms/durable/readme.html
===================================================================
--- trunk/examples/jms/durable/readme.html	2009-03-31 10:51:19 UTC (rev 6231)
+++ trunk/examples/jms/durable/readme.html	2009-03-31 10:53:10 UTC (rev 6232)
@@ -111,7 +111,7 @@
            <code>session.unsubscribe("subscriber-1");</code>
         </pre>
 
-	<li>And finally (no pun intended), <b>always</b> remember to close your JMS connections after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
+	<li>And finally (no pun intended), <b>always</b> remember to close your JMS connections after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its session, consumer, producer and browser objects</li>
 
         <pre>
            <code>
@@ -120,7 +120,7 @@
       {
          if (connection != null)
          {
-            // Step 20. Be sure to close our JMS resources!
+            // Be sure to close our JMS resources!
             connection.close();
          }
       }

Modified: trunk/examples/jms/durable/src/org/jboss/jms/example/DurableSubscriberExample.java
===================================================================
--- trunk/examples/jms/durable/src/org/jboss/jms/example/DurableSubscriberExample.java	2009-03-31 10:51:19 UTC (rev 6231)
+++ trunk/examples/jms/durable/src/org/jboss/jms/example/DurableSubscriberExample.java	2009-03-31 10:53:10 UTC (rev 6232)
@@ -47,72 +47,72 @@
       Connection connection = null;
       try
       {
-         //Step 1. Create an initial context to perform the JNDI lookup.
+         // Step 1. Create an initial context to perform the JNDI lookup.
          InitialContext initialContext = getContext();
-         
-         //Step 2. Look-up the JMS topic
-         Topic topic = (Topic) initialContext.lookup("/topic/exampleTopic");
-         
-         //Step 3. Look-up the JMS connection factory
-         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
-         
-         //Step 4. Create a JMS connection
+
+         // Step 2. Look-up the JMS topic
+         Topic topic = (Topic)initialContext.lookup("/topic/exampleTopic");
+
+         // Step 3. Look-up the JMS connection factory
+         ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
+
+         // Step 4. Create a JMS connection
          connection = cf.createConnection();
-         
-         //Step 5. Set the client-id on the connection
+
+         // Step 5. Set the client-id on the connection
          connection.setClientID("durable-client");
-         
-         //Step 6. Start the connection
+
+         // Step 6. Start the connection
          connection.start();
-         
-         //Step 7. Create a JMS session
+
+         // Step 7. Create a JMS session
          Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         
-         //Step 8. Create a JMS message producer
+
+         // Step 8. Create a JMS message producer
          MessageProducer messageProducer = session.createProducer(topic);
 
-         //Step 9. Create the subscription and the subscriber.
+         // Step 9. Create the subscription and the subscriber.
          TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subscriber-1");
-         
-         //Step 10. Create a text message
+
+         // Step 10. Create a text message
          TextMessage message1 = session.createTextMessage("This is a text message 1");
-         
-         //Step 11. Send the text message to the topic
+
+         // Step 11. Send the text message to the topic
          messageProducer.send(message1);
-         
+
          System.out.println("Sent message: " + message1.getText());
-         
-         //Step 12. Consume the message from the durable subscription
-                           
+
+         // Step 12. Consume the message from the durable subscription
+
          TextMessage messageReceived = (TextMessage)subscriber.receive();
-         
+
          System.out.println("Received message: " + messageReceived.getText());
-         
-         //Step 13. Create and send another message
-         
+
+         // Step 13. Create and send another message
+
          TextMessage message2 = session.createTextMessage("This is a text message 2");
-         
+
          messageProducer.send(message2);
-         
+
          System.out.println("Sent message: " + message2.getText());
-         
-         //Step 14. Close the subscriber - the server could even be stopped at this point!
+
+         // Step 14. Close the subscriber - the server could even be stopped at this point!
          subscriber.close();
-         
-         //Step 15. Create a new subscriber on the *same* durable subscription.
-         
+
+         // Step 15. Create a new subscriber on the *same* durable subscription.
+
          subscriber = session.createDurableSubscriber(topic, "subscriber-1");
-         
-         //Step 16. Consume the message
-         
+
+         // Step 16. Consume the message
+
          messageReceived = (TextMessage)subscriber.receive();
-         
+
          System.out.println("Received message: " + messageReceived.getText());
-         
-         //Step 17. Close the subscriber
+
+         // Step 17. Close the subscriber
          subscriber.close();
-         
-         //Step 18. Delete the durable subscription
+
+         // Step 18. Delete the durable subscription
          session.unsubscribe("subscriber-1");
       }
       finally




More information about the jboss-cvs-commits mailing list