[jboss-cvs] JBoss Messaging SVN: r6369 - in trunk/examples/jms/scheduled-message: src/org/jboss/jms/example and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 8 11:40:40 EDT 2009
Author: gaohoward
Date: 2009-04-08 11:40:39 -0400 (Wed, 08 Apr 2009)
New Revision: 6369
Modified:
trunk/examples/jms/scheduled-message/readme.html
trunk/examples/jms/scheduled-message/src/org/jboss/jms/example/ScheduledMessageExample.java
Log:
some correction of doc inconsistence with code
Modified: trunk/examples/jms/scheduled-message/readme.html
===================================================================
--- trunk/examples/jms/scheduled-message/readme.html 2009-04-08 15:17:26 UTC (rev 6368)
+++ trunk/examples/jms/scheduled-message/readme.html 2009-04-08 15:40:39 UTC (rev 6369)
@@ -10,6 +10,8 @@
<p>A Scheduled Message is a message that will be delivered at a time specified by the sender. To do this,
simply set a HDR_SCHEDULED_DELIVERY_TIME header property. The value of the property should be the time of
deliver in milliseconds. </p>
+
+ <p>In this example, a message is created with the scheduled delivery time set to 5 seconds after.</p>
<br>
<h2>Example step-by-step</h2>
@@ -43,21 +45,21 @@
<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>
+ <code>MessageProducer producer = session.createProducer(queue);</code>
</pre>
<li>We create a JMS text message that we are going to send.</li>
<pre>
- <code>TextMessage message = session.createTextMessage("This is a text message");</code>
+ <code>TextMessage message = session.createTextMessage("This is a scheduled message message will arrived in 5 sec.");</code>
</pre>
- <li>We schedule the delivery time to be sec later.</li>
+ <li>We schedule the delivery time to be 5 sec later.</li>
<pre>
<code>
- long time = System.currentTimeMillis();
- time += 5000;
- message.setLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME.toString(), time);
- </code>
+ long time = System.currentTimeMillis();
+ time += 5000;
+ message.setLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME.toString(), time);
+ </code>
</pre>
<li>We send message to the queue</li>
@@ -75,9 +77,9 @@
<code>connection.start();</code>
</pre>
- <li>The message arrives at the consumer. In this case we use a timeout of 5000 milliseconds but we could use a blocking 'receive()'</li>
+ <li>We use a blocking receive() to consume the message and see when the message arrives.</li>
<pre>
- <code>TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);</code>
+ <code>TextMessage messageReceived = (TextMessage) messageConsumer.receive();</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>
Modified: trunk/examples/jms/scheduled-message/src/org/jboss/jms/example/ScheduledMessageExample.java
===================================================================
--- trunk/examples/jms/scheduled-message/src/org/jboss/jms/example/ScheduledMessageExample.java 2009-04-08 15:17:26 UTC (rev 6368)
+++ trunk/examples/jms/scheduled-message/src/org/jboss/jms/example/ScheduledMessageExample.java 2009-04-08 15:40:39 UTC (rev 6369)
@@ -102,7 +102,7 @@
}
finally
{
- //Step 12. Be sure to close our JMS resources!
+ //Step 13. Be sure to close our JMS resources!
if (initialContext != null)
{
initialContext.close();
More information about the jboss-cvs-commits
mailing list