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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 6 08:32:03 EDT 2009


Author: timfox
Date: 2009-04-06 08:32:03 -0400 (Mon, 06 Apr 2009)
New Revision: 6318

Added:
   trunk/examples/jms/durable-subscription/
   trunk/examples/jms/durable-subscription/build.xml
   trunk/examples/jms/durable-subscription/config/
   trunk/examples/jms/durable-subscription/readme.html
   trunk/examples/jms/durable-subscription/src/
Removed:
   trunk/examples/jms/durable-subscription/build.xml
   trunk/examples/jms/durable-subscription/config/
   trunk/examples/jms/durable-subscription/readme.html
   trunk/examples/jms/durable-subscription/src/
   trunk/examples/jms/durable/
Modified:
   trunk/.classpath
Log:
renamed subscription to durable-subscription

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2009-04-06 12:28:51 UTC (rev 6317)
+++ trunk/.classpath	2009-04-06 12:32:03 UTC (rev 6318)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
+	<classpathentry kind="src" path="examples/jms/durable-subscription/src"/>
 	<classpathentry kind="src" path="build/src"/>
 	<classpathentry kind="src" path="tests/config"/>
 	<classpathentry kind="src" path="src/config"/>
@@ -17,7 +18,6 @@
 	<classpathentry kind="src" path="examples/jms/common/src"/>
 	<classpathentry kind="src" path="examples/jms/clustered-queue/src"/>
 	<classpathentry kind="src" path="examples/jms/dead-letter/src"/>
-	<classpathentry kind="src" path="examples/jms/durable/src"/>
 	<classpathentry kind="src" path="examples/jms/expiry/src"/>
 	<classpathentry kind="src" path="examples/jms/large-message/src"/>
 	<classpathentry kind="src" path="examples/jms/paging/src"/>

Copied: trunk/examples/jms/durable-subscription (from rev 6312, trunk/examples/jms/durable)

Deleted: trunk/examples/jms/durable-subscription/build.xml
===================================================================
--- trunk/examples/jms/durable/build.xml	2009-04-04 00:30:06 UTC (rev 6312)
+++ trunk/examples/jms/durable-subscription/build.xml	2009-04-06 12:32:03 UTC (rev 6318)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE project [
-      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
-      ]>
-
-<!-- =========================================================================================== -->
-<!--                                                                                             -->
-<!-- JBoss, Home of Professional Open Source                                                     -->
-<!-- Copyright 2005, JBoss Inc., and individual contributors as indicated                        -->
-<!-- by the @authors tag. See the copyright.txt in the distribution for a                        -->
-<!-- full listing of individual contributors.                                                    -->
-<!--                                                                                             -->
-<!-- This is free software; you can redistribute it and/or modify it                             -->
-<!-- under the terms of the GNU Lesser General Public License as                                 -->
-<!-- published by the Free Software Foundation; either version 2.1 of                            -->
-<!-- the License, or (at your option) any later version.                                         -->
-<!--                                                                                             -->
-<!-- This software is distributed in the hope that it will be useful,                            -->
-<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of                              -->
-<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                            -->
-<!-- Lesser General Public License for more details.                                             -->
-<!--                                                                                             -->
-<!-- You should have received a copy of the GNU Lesser General Public                            -->
-<!-- License along with this software; if not, write to the Free                                 -->
-<!-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA                          -->
-<!-- 02110-1301 USA, or see the FSF site: http://www.fsf.org.                                    -->
-<!--                                                                                             -->
-<!-- =========================================================================================== -->
-
-
-<project default="run" name="JBoss Messaging JMS Durable Subscriber Example">
-
-   <import file="../common/build.xml"/>
-
-   <target name="run">
-      <antcall target="runExample">
-         <param name="example.classname" value="org.jboss.jms.example.DurableSubscriberExample"/>
-      </antcall>
-   </target>
-
-   <target name="runRemote">
-      <antcall target="runExample">
-         <param name="example.classname" value="org.jboss.jms.example.DurableSubscriberExample"/>
-         <param name="jbm.example.runServer" value="false"/>
-      </antcall>
-   </target>
-
-</project>
\ No newline at end of file

Copied: trunk/examples/jms/durable-subscription/build.xml (from rev 6317, trunk/examples/jms/durable/build.xml)
===================================================================
--- trunk/examples/jms/durable-subscription/build.xml	                        (rev 0)
+++ trunk/examples/jms/durable-subscription/build.xml	2009-04-06 12:32:03 UTC (rev 6318)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+      <!ENTITY libraries SYSTEM "../../../thirdparty/libraries.ent">
+      ]>
+
+<!-- =========================================================================================== -->
+<!--                                                                                             -->
+<!-- JBoss, Home of Professional Open Source                                                     -->
+<!-- Copyright 2005, JBoss Inc., and individual contributors as indicated                        -->
+<!-- by the @authors tag. See the copyright.txt in the distribution for a                        -->
+<!-- full listing of individual contributors.                                                    -->
+<!--                                                                                             -->
+<!-- This is free software; you can redistribute it and/or modify it                             -->
+<!-- under the terms of the GNU Lesser General Public License as                                 -->
+<!-- published by the Free Software Foundation; either version 2.1 of                            -->
+<!-- the License, or (at your option) any later version.                                         -->
+<!--                                                                                             -->
+<!-- This software is distributed in the hope that it will be useful,                            -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of                              -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                            -->
+<!-- Lesser General Public License for more details.                                             -->
+<!--                                                                                             -->
+<!-- You should have received a copy of the GNU Lesser General Public                            -->
+<!-- License along with this software; if not, write to the Free                                 -->
+<!-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA                          -->
+<!-- 02110-1301 USA, or see the FSF site: http://www.fsf.org.                                    -->
+<!--                                                                                             -->
+<!-- =========================================================================================== -->
+
+
+<project default="run" name="JBoss Messaging JMS Durable Subscriber Example">
+
+   <import file="../common/build.xml"/>
+
+   <target name="run">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.DurableSubscriptionExample"/>
+      </antcall>
+   </target>
+
+   <target name="runRemote">
+      <antcall target="runExample">
+         <param name="example.classname" value="org.jboss.jms.example.DurableSubscriptionExample"/>
+         <param name="jbm.example.runServer" value="false"/>
+      </antcall>
+   </target>
+
+</project>
\ No newline at end of file

Copied: trunk/examples/jms/durable-subscription/config (from rev 6317, trunk/examples/jms/durable/config)

Deleted: trunk/examples/jms/durable-subscription/readme.html
===================================================================
--- trunk/examples/jms/durable/readme.html	2009-04-04 00:30:06 UTC (rev 6312)
+++ trunk/examples/jms/durable-subscription/readme.html	2009-04-06 12:32:03 UTC (rev 6318)
@@ -1,135 +0,0 @@
-<html>
-  <head>
-    <title>JBoss Messaging JMS Durable Subscription Example</title>
-    <link rel="stylesheet" type="text/css" href="../common/common.css">
-  </head>
-  <body>
-     <h1>JMS Durable Subscription Example</h1>
-     <br>
-     <p>This example shows you how to use a durable subscription with JBoss Messaging.</p>
-     <p>Durable subscriptions are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p>
-     <p>Unlike non durable subscriptions, the key function of durable subscriptions is that the messages contained in them persist longer than the lifetime of the subscriber - i.e. they will accumulate messages sent to the topic even if there is no active subscriber on them. They will also survive server restarts. Note that for the messages to be persisted, the messages sent to them must be marked as persistent messages.</p>
-     <br>
-     <h2>Example step-by-step</h2>
-     <p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
-     <br>
-     <ol>
-        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
-        <pre>
-           <code>initialContext = getContext();</code>
-        </pre>
-
-        <li>We look-up the JMS topic object from JNDI</li>
-        <pre>
-           <code>Topic topic = (Topic) initialContext.lookup("/topic/exampleTopic");</code>
-        </pre>
-
-        <li>We look-up the JMS connection factory object from JNDI</li>
-        <pre>
-           <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
-        </pre>
-
-        <li>We create a JMS connection</li>
-        <pre>
-           <code>connection = cf.createConnection();</code>
-        </pre>
-         
-        <li>We set the client-id on the connection. This must be the <b>first operation</b> performed on the connection object.
-        The combination of client-id and durable subscription name uniquely identifies the durable subscription. Maybe different durable subscritions can have the same name if they belong to different client-id values</li>
-        <pre>
-           <code>connection.setClientID("durable-client");</code>
-        </pre>
-         
-        <li>We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started</li>
-        <pre>
-           <code>connection.start();</code>
-        </pre>
-         
-        <li>We create a JMS session. The session is created as non transacted and will auto acknowledge messages.</li>
-        <pre>
-           <code>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
-        </pre>
-
-        <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
-	<pre>
-	   <code>MessageProducer messageProducer = session.createProducer(topic);</code>
-        </pre>
-
-        <li>We create the durable subscriber on the topic, specifying it's name. Since this is the first time the subscriber is created and a subscription with that name and for this client-id does not already exist, then the underlying durable subscription will be created, and a subscriber will be created and returned for that subscription.</li>
-	<pre>
-           <code>TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subscriber-1");</code>
-        </pre>
-         
-        <li>We create a JMS text message, message 1, that we are going to send. Note that it must be a persistent message in order to survive server restart.</li>
-        <pre>
-           <code>TextMessage message1 = session.createTextMessage("This is a text message 1");</code>
-        </pre>
-   
-        <li>We send message 1 to the topic</li>
-        <pre>
-           <code>messageProducer.send(message1);</code>
-        </pre>
-
-        <li>The message arrives in the subscription, and we consume the message from the subscription.</li>
-        <pre>
-           <code>TextMessage messageReceived = (TextMessage)subscriber.receive();</code>
-        </pre>
-
-        <li>We create and send another text message, message 2, to the same topic</li>
-	<pre>
-           <code>TextMessage message2 = session.createTextMessage("This is a text message 2");</code>
-	   <br>
-           <code>messageProducer.send(message2);</code>
-        </pre>
-         
-        <li>Now we close the subscriber. Since the subscription is durable it will continue to survive even though there is no subscriber attached to it. At this point you could even stop and restart the server and the subscription would survive!</li>
-
-        <pre>
-           <code>subscriber.close();</code>
-        </pre>
-         
-        <li>We now create another durable subscriber, with the same name and same client-id on the same topic. Since the durable subscrition already exists, it will simply return a new subscriber consuming from the <i>same</i> durable subscription instance as before</li>
-
-        <pre> 
-           <code>subscriber = session.createDurableSubscriber(topic, "subscriber-1");</code>
-        </pre>
-         
-        <li>We consume message 2 which was sent before the first subscriber was closed.</li>
-
-        <pre>
-           <code>messageReceived = (TextMessage)subscriber.receive();</code>
-        </pre>
-
-        <li>We close the second subscriber.</li>
-
-        <pre>
-           <code>subscriber.close();</code>
-        </pre>
-
-        <li>Now we <i>delete</i> the underlying durable subscription. This will delete any remaining unacknowledged messages in the subscription and a new subscriber will not be able to access them</li>
-
-        <pre>
-           <code>session.unsubscribe("subscriber-1");</code>
-        </pre>
-
-        <li>And finally, <b>always</b> remember to close your JMS connections and resources 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>
-
-        <pre>
-           <code>finally
-           {
-              if (initialContext != null)
-              {
-                initialContext.close();
-              }
-              if (connection != null)
-              {
-                 connection.close();
-              }
-           }</code>
-        </pre>
-
-
-         
-     </ol>
-  </body>
-</html>

Copied: trunk/examples/jms/durable-subscription/readme.html (from rev 6317, trunk/examples/jms/durable/readme.html)
===================================================================
--- trunk/examples/jms/durable-subscription/readme.html	                        (rev 0)
+++ trunk/examples/jms/durable-subscription/readme.html	2009-04-06 12:32:03 UTC (rev 6318)
@@ -0,0 +1,135 @@
+<html>
+  <head>
+    <title>JBoss Messaging JMS Durable Subscription Example</title>
+    <link rel="stylesheet" type="text/css" href="../common/common.css">
+  </head>
+  <body>
+     <h1>JMS Durable Subscription Example</h1>
+     <br>
+     <p>This example shows you how to use a durable subscription with JBoss Messaging.</p>
+     <p>Durable subscriptions are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p>
+     <p>Unlike non durable subscriptions, the key function of durable subscriptions is that the messages contained in them persist longer than the lifetime of the subscriber - i.e. they will accumulate messages sent to the topic even if there is no active subscriber on them. They will also survive server restarts. Note that for the messages to be persisted, the messages sent to them must be marked as persistent messages.</p>
+     <br>
+     <h2>Example step-by-step</h2>
+     <p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
+     <br>
+     <ol>
+        <li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
+        <pre>
+           <code>initialContext = getContext();</code>
+        </pre>
+
+        <li>We look-up the JMS topic object from JNDI</li>
+        <pre>
+           <code>Topic topic = (Topic) initialContext.lookup("/topic/exampleTopic");</code>
+        </pre>
+
+        <li>We look-up the JMS connection factory object from JNDI</li>
+        <pre>
+           <code>ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");</code>
+        </pre>
+
+        <li>We create a JMS connection</li>
+        <pre>
+           <code>connection = cf.createConnection();</code>
+        </pre>
+         
+        <li>We set the client-id on the connection. This must be the <b>first operation</b> performed on the connection object.
+        The combination of client-id and durable subscription name uniquely identifies the durable subscription. Maybe different durable subscritions can have the same name if they belong to different client-id values</li>
+        <pre>
+           <code>connection.setClientID("durable-client");</code>
+        </pre>
+         
+        <li>We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started</li>
+        <pre>
+           <code>connection.start();</code>
+        </pre>
+         
+        <li>We create a JMS session. The session is created as non transacted and will auto acknowledge messages.</li>
+        <pre>
+           <code>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</code>
+        </pre>
+
+        <li>We create a JMS message producer on the session. This will be used to send the messages.</li>
+	<pre>
+	   <code>MessageProducer messageProducer = session.createProducer(topic);</code>
+        </pre>
+
+        <li>We create the durable subscriber on the topic, specifying it's name. Since this is the first time the subscriber is created and a subscription with that name and for this client-id does not already exist, then the underlying durable subscription will be created, and a subscriber will be created and returned for that subscription.</li>
+	<pre>
+           <code>TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subscriber-1");</code>
+        </pre>
+         
+        <li>We create a JMS text message, message 1, that we are going to send. Note that it must be a persistent message in order to survive server restart.</li>
+        <pre>
+           <code>TextMessage message1 = session.createTextMessage("This is a text message 1");</code>
+        </pre>
+   
+        <li>We send message 1 to the topic</li>
+        <pre>
+           <code>messageProducer.send(message1);</code>
+        </pre>
+
+        <li>The message arrives in the subscription, and we consume the message from the subscription.</li>
+        <pre>
+           <code>TextMessage messageReceived = (TextMessage)subscriber.receive();</code>
+        </pre>
+
+        <li>We create and send another text message, message 2, to the same topic</li>
+	<pre>
+           <code>TextMessage message2 = session.createTextMessage("This is a text message 2");</code>
+	   <br>
+           <code>messageProducer.send(message2);</code>
+        </pre>
+         
+        <li>Now we close the subscriber. Since the subscription is durable it will continue to survive even though there is no subscriber attached to it. At this point you could even stop and restart the server and the subscription would survive!</li>
+
+        <pre>
+           <code>subscriber.close();</code>
+        </pre>
+         
+        <li>We now create another durable subscriber, with the same name and same client-id on the same topic. Since the durable subscrition already exists, it will simply return a new subscriber consuming from the <i>same</i> durable subscription instance as before</li>
+
+        <pre> 
+           <code>subscriber = session.createDurableSubscriber(topic, "subscriber-1");</code>
+        </pre>
+         
+        <li>We consume message 2 which was sent before the first subscriber was closed.</li>
+
+        <pre>
+           <code>messageReceived = (TextMessage)subscriber.receive();</code>
+        </pre>
+
+        <li>We close the second subscriber.</li>
+
+        <pre>
+           <code>subscriber.close();</code>
+        </pre>
+
+        <li>Now we <i>delete</i> the underlying durable subscription. This will delete any remaining unacknowledged messages in the subscription and a new subscriber will not be able to access them</li>
+
+        <pre>
+           <code>session.unsubscribe("subscriber-1");</code>
+        </pre>
+
+        <li>And finally, <b>always</b> remember to close your JMS connections and resources 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>
+
+        <pre>
+           <code>finally
+           {
+              if (initialContext != null)
+              {
+                initialContext.close();
+              }
+              if (connection != null)
+              {
+                 connection.close();
+              }
+           }</code>
+        </pre>
+
+
+         
+     </ol>
+  </body>
+</html>

Copied: trunk/examples/jms/durable-subscription/src (from rev 6317, trunk/examples/jms/durable/src)




More information about the jboss-cvs-commits mailing list