[jboss-cvs] JBoss Messaging SVN: r5336 - in branches/Branch_1416_merge/docs/examples: ordering-group-1 and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 11 06:34:32 EST 2008
Author: gaohoward
Date: 2008-11-11 06:34:32 -0500 (Tue, 11 Nov 2008)
New Revision: 5336
Added:
branches/Branch_1416_merge/docs/examples/ordering-group-1/
branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html
branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java
Removed:
branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html
branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties
branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java
branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java
Log:
JBMESSAGING-1416 example
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1 (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1)
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/README.html 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,132 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <meta content="text/html; charset=ISO-8859-1"
- http-equiv="content-type">
- <title>JBoss Messaging Example - JMS Queue</title>
-</head>
-<body>
-<br>
-<h1>JBoss Messaging Queue Example</h1>
-$Revision: 2750 $
-<h2>Overview</h2>
-<br>
-This example creates a JMS Connection to a JBoss Messaging instance
-and uses it to create a session and a message producer, which sends a
-message to the queue "queue/testQueue". Then, the example uses
-the same connection to create a consumer that that reads
-a single message from the queue. The example is considered successful
-if the message consumer receives without any error the message that was
-sent by the producer. <br>
-<br>
-This example relies on having access to a running JBoss Messaging
-instance.
-The JBoss Messaging instance must be installed and started according to
-the
-"Installation" paragraph from the release documentation. However, the
-example will automatically deploy its own queue, unless a queue with
-the same name is already deployed. <br>
-<br>
-This example also relies on having access to <span
- style="font-family: monospace;">jboss-messaging-client.jar</span>
-archive that comes with the release bundle. If you run this example
-from an unzipped installation bundle, the example run script is
-correctly configured to find the client jar. Otherwise, you must modify
-example's <span style="font-family: monospace;">build.xml</span>
-accordingly.<br>
-<br>
-<span style="font-style: italic;"></span>
-<h2>Running the example</h2>
-1. Set up the JBOSS_HOME environment variable to point to the JBoss
-instance you deployed JBoss Messaging into. For example, if you
-deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
-then your JBOSS_HOME value should be <span
- style="font-family: monospace;">C:\</span><span
- style="font-family: monospace;">jboss-4.2.0.GA</span><br>
-<span style="font-family: monospace;"></span><span
- style="font-family: monospace;"></span><br>
-2. Go to the example's home directory<br>
-<br>
-<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
-...\examples\queue</span><br>
-</div>
-<br>
-3. Run the example:<br>
-<br>
-<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
-<br>
-<br>
-<br>
-</div>
-The output of a successful run should be similar to:<br>
-<div style="margin-left: 40px;"><br>
-</div>
-<table
- style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
- border="1" cellpadding="2" cellspacing="2">
- <tbody>
- <tr>
- <td style="vertical-align: top;">
-<pre>
-Buildfile: build.xml
-
-identify:
- [echo] ###########################################################################
- [echo] # Running the QUEUE example #
- [echo] ###########################################################################
- [echo] The queue: testQueue
- [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
-
-sanity-check:
-
-init:
- [mkdir] Created dir: C:\java\messaging\docs\examples\queue\output\classes
- [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
-
-compile:
- [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
- [javac] Compiling 1 source file to C:\java\messaging\docs\examples\queue\output\classes
-
-run:
- [java] Queue /queue/testQueue exists
- [java] The message was successfully sent to the testQueue queue
- [java] Received message: Hello!
- [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
- [java]
- [java] #####################
- [java] ### SUCCESS! ###
- [java] #####################
-
-BUILD SUCCESSFUL
-Total time: 4 seconds
-</pre>
- </td>
- </tr>
- </tbody>
-</table>
-<div style="margin-left: 40px;"><br>
-</div>
-<br>
-<br>
-<h2>Troublesooting</h2>
-<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
-User null is NOT authenticated" <br>
-</span></h3>
-You probably didn't install JBoss Messaging correctly. A fresh JBoss
-Messaging installation requires changes in the security configuration
-of a <span style="font-family: monospace;">default </span>JBoss
-instance, specifically a properly configured "<small><span
- style="font-family: courier new,courier,monospace;">messaging</span></small>"
-security domain. Follow the instructions from the "Installation"
-paragraph of the release documentation. <br>
-<br>
-<br>
-<hr style="width: 100%; height: 2px;"><br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-</body>
-</html>
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/README.html)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/README.html 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,132 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - JMS Queue</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Queue Example</h1>
+$Revision: 2750 $
+<h2>Overview</h2>
+<br>
+This example creates a JMS Connection to a JBoss Messaging instance
+and uses it to create a session and a message producer, which sends a
+message to the queue "queue/testQueue". Then, the example uses
+the same connection to create a consumer that that reads
+a single message from the queue. The example is considered successful
+if the message consumer receives without any error the message that was
+sent by the producer. <br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\queue</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the QUEUE example #
+ [echo] ###########################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\queue\output\classes
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 1 source file to C:\java\messaging\docs\examples\queue\output\classes
+
+run:
+ [java] Queue /queue/testQueue exists
+ [java] The message was successfully sent to the testQueue queue
+ [java] Received message: Hello!
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+BUILD SUCCESSFUL
+Total time: 4 seconds
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/build.xml 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-
- To run the example, set JBOSS_HOME and run ant (with no parameters)
-
- $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
-
- -->
-
-<project name="OrderingGroupExample" default="run">
-
- <property environment="ENV"/>
-
- <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
- <property file="../examples.properties"/>
- <property name="messaging.client.jar.path" value="../../"/>
- <property name="messaging.client.jar.name" value="jboss-messaging-client.jar"/>
- <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
- <property name="jboss.configuration" value="messaging"/>
- <property name="example.queue.name" value="testQueue"/>
-
- <path id="common.compilation.classpath">
- <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
- <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
- </path>
-
- <path id="example.compilation.classpath">
- <path refid="common.compilation.classpath"/>
- <pathelement path="../common/output/classes"/>
- </path>
-
- <path id="execution.classpath">
- <pathelement path="./etc"/>
- <pathelement path="../common/output/classes"/>
- <pathelement path="./output/classes"/>
- <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
- <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
- <fileset file="${jboss.home}/client/jbossall-client.jar"/>
- <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
- <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
- <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
- <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
- </path>
-
- <target name="identify">
- <echo message="###########################################################################"/>
- <echo message="# Running the OrderingGroup example #"/>
- <echo message="###########################################################################"/>
- <echo message="The queue: ${example.queue.name}"/>
- <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}"/>
- </target>
-
- <target name="sanity-check" depends="identify">
- <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
- <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}"
- unless="client.jar.present"/>
- </target>
-
- <target name="init" depends="sanity-check">
- <mkdir dir="./output/classes"/>
- <mkdir dir="../common/output/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
- <src path="../common/src"/>
- <classpath refid="common.compilation.classpath"/>
- </javac>
- <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
- <src path="./src"/>
- <classpath refid="example.compilation.classpath"/>
- </javac>
- </target>
-
- <target name="run" depends="compile">
- <!-- QueueExample expects to find the name of the queue to connect to as value of the
- 'example.queue.name' property, which *may* be defined by calling ants when this example
- is used in a smoke test -->
- <java classname="org.jboss.example.jms.ordering.OrderingGroupExample"
- classpathref="execution.classpath" fork="yes" failonerror="true">
- <sysproperty key="example.queue.name" value="${example.queue.name}"/>
- <sysproperty key="com.sun.management.jmxremote" value=""/>
- <!--
- <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
- -->
- </java>
- </target>
-
- <target name="clean">
- <delete dir="./output" quiet="true"/>
- <delete dir="../common/output" quiet="true"/>
- </target>
-
-</project>
-
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/build.xml)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/build.xml 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
+
+ -->
+
+<project name="OrderingGroupExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties"/>
+ <property name="messaging.client.jar.path" value="../../"/>
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar"/>
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
+ <property name="jboss.configuration" value="messaging"/>
+ <property name="example.queue.name" value="testQueue"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="../common/output/classes"/>
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <fileset file="${jboss.home}/client/jbossall-client.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################"/>
+ <echo message="# Running the OrderingGroup example #"/>
+ <echo message="###########################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}"
+ unless="client.jar.present"/>
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="example.compilation.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.ordering.OrderingGroupExample"
+ classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <sysproperty key="com.sun.management.jmxremote" value=""/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+</project>
+
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/etc (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/etc)
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/etc/jndi.properties 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,4 +0,0 @@
-### JBossNS properties
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/etc/jndi.properties)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/jndi.properties 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/etc/log4j.xml 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <param name="Threshold" value="INFO"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
- </layout>
- </appender>
-
- <root>
- <appender-ref ref="CONSOLE"/>
- </root>
-
-</log4j:configuration>
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/etc/log4j.xml)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/etc/log4j.xml 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src)
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org)
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss)
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example)
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms)
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering)
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-package org.jboss.example.jms.ordering;
-
-import java.util.Random;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.Destination;
-
-public class ConsumerThread extends Thread
-{
- private OrderingGroupExample example;
- private Session session;
- private MessageConsumer consumer;
- private Connection connection;
-
- public ConsumerThread(String name, OrderingGroupExample theExample, ConnectionFactory fact, Destination queue) throws JMSException
- {
- super(name);
- example = theExample;
-
- connection = fact.createConnection();
- session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- consumer = session.createConsumer(queue);
- connection.start();
- }
-
- public void delay(long nt)
- {
- try
- {
- Thread.sleep(nt);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- //receiving the messages
- public void run()
- {
- int n = example.getNumMessages();
- try
- {
- System.err.println(getName() + " start working now.....");
- int timeToSleep = 0;
- while (true)
- {
- if (example.allReceived())
- {
- System.err.println("message all received, break.");
- break;
- }
- TextMessage msg = (TextMessage)consumer.receive(2000);
- if (msg != null)
- {
- System.err.println("Message received: " + msg.getText() + " by " + this.getName());
- //System.err.println("No Calling ack");
- if (msg.getText().equals(OrderingGroupExample.ORDERING_MSG1))
- {
- System.err.println("First message got by me (" + getName() + "), so sleep");
- //whoever receives first message, delay for 2 sec.
- delay(2000);
- }
- example.reportReceive(msg);
- msg.acknowledge();
- }
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- }
- finally
- {
- if (session != null)
- {
- try
- {
- connection.close();
- }
- catch (JMSException e)
- {
- }
- }
- }
- }
-
-}
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/ConsumerThread.java 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+package org.jboss.example.jms.ordering;
+
+import java.util.Random;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.Destination;
+
+public class ConsumerThread extends Thread
+{
+ private OrderingGroupExample example;
+ private Session session;
+ private MessageConsumer consumer;
+ private Connection connection;
+
+ public ConsumerThread(String name, OrderingGroupExample theExample, ConnectionFactory fact, Destination queue) throws JMSException
+ {
+ super(name);
+ example = theExample;
+
+ connection = fact.createConnection();
+ session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ consumer = session.createConsumer(queue);
+ connection.start();
+ }
+
+ public void delay(long nt)
+ {
+ try
+ {
+ Thread.sleep(nt);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ //receiving the messages
+ public void run()
+ {
+ int n = example.getNumMessages();
+ try
+ {
+ System.err.println(getName() + " start working now.....");
+ int timeToSleep = 0;
+ while (true)
+ {
+ if (example.allReceived())
+ {
+ System.err.println("message all received, break.");
+ break;
+ }
+ TextMessage msg = (TextMessage)consumer.receive(2000);
+ if (msg != null)
+ {
+ System.err.println("Message received: " + msg.getText() + " by " + this.getName());
+ //System.err.println("No Calling ack");
+ if (msg.getText().equals(OrderingGroupExample.ORDERING_MSG1))
+ {
+ System.err.println("First message got by me (" + getName() + "), so sleep");
+ //whoever receives first message, delay for 2 sec.
+ delay(2000);
+ }
+ example.reportReceive(msg);
+ msg.acknowledge();
+ }
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (session != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException e)
+ {
+ }
+ }
+ }
+ }
+
+}
Deleted: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java 2008-11-11 06:29:27 UTC (rev 5331)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java 2008-11-11 11:34:32 UTC (rev 5336)
@@ -1,219 +0,0 @@
-/*
- * 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.
- */
-package org.jboss.example.jms.ordering;
-
-import java.util.ArrayList;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Message;
-import javax.naming.InitialContext;
-
-import org.jboss.example.jms.common.ExampleSupport;
-import org.jboss.jms.client.JBossMessageProducer;
-
-/**
- * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
- * session and a message producer, which sends a message to the queue "queue/testQueue". Then, the
- * example uses the same connection to create a consumer that that reads a single message from the
- * queue. The example is considered successful if the message consumer receives without any error
- * the message that was sent by the producer.
- *
- * Since this example is also used by the smoke test, it is essential that the VM exits with exit
- * code 0 in case of successful execution and a non-zero value on failure.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 2868 $</tt>
- *
- * $Id: QueueExample.java 2868 2007-07-10 20:22:16Z timfox $
- */
-public class OrderingGroupExample extends ExampleSupport
-{
- public static final String NORMAL_MSG = "Hello-normal";
- public static final String NORMAL_MSG1 = "Hello-normal-1";
- public static final String ORDERING_MSG1 = "Hello!";
- public static final String ORDERING_MSG2 = "Hello-1!";
- public static final String ORDERING_MSG3 = "Hello-2!";
-
- private ArrayList<String> deliveryRecords = new ArrayList<String>();
-
- private void checkResults() throws Exception
- {
- int len = deliveryRecords.size();
- System.out.println("len: " + len);
- if (len != 5)
- {
- System.err.println("=====Error, the len is not 5!=====");
- }
- int n1 = deliveryRecords.indexOf(ORDERING_MSG1);
- int n2 = deliveryRecords.indexOf(ORDERING_MSG2);
- int n3 = deliveryRecords.indexOf(ORDERING_MSG3);
- System.out.println("n1: " + n1 + " n2: " + n2 + " n3: " + n3);
- if ( (n1 < n2) && (n2 < n3) )
- {
- System.out.println("=====Correct=======");
- }
- else
- {
- System.err.println("=====Error======");
- }
- }
-
- public boolean allReceived()
- {
- synchronized(deliveryRecords)
- {
- return deliveryRecords.size() == 5;
- }
- }
-
- public void example() throws Exception
- {
- String destinationName = getDestinationJNDIName();
-
- InitialContext ic = null;
- ConnectionFactory cf = null;
- Connection connection = null;
-
- try
- {
- ic = new InitialContext();
-
- cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
- Queue queue = (Queue)ic.lookup(destinationName);
- log("Queue " + destinationName + " exists");
-
- connection = cf.createConnection();
- Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
-
- JBossMessageProducer producer1 = (JBossMessageProducer)session.createProducer(queue);
- TextMessage normalMsg = session.createTextMessage(NORMAL_MSG);
- TextMessage normalMsg1 = session.createTextMessage(NORMAL_MSG1);
-
- log("Sending mormal message with lower priority 1");
- producer1.send(normalMsg1, Message.DEFAULT_DELIVERY_MODE, 1, Message.DEFAULT_TIME_TO_LIVE);
-
- JBossMessageProducer producer = (JBossMessageProducer)session.createProducer(queue);
- producer.enableOrderingGroup("MyOrderingGroup");
-
- TextMessage message = session.createTextMessage(ORDERING_MSG1);
- message.setJMSPriority(0);
- log("Sending message with priority 0");
- producer.send(message, Message.DEFAULT_DELIVERY_MODE, 5, Message.DEFAULT_TIME_TO_LIVE);
-
- TextMessage message2 = session.createTextMessage(ORDERING_MSG2);
- log("Sending message2 with priority 8");
- producer.send(message2, Message.DEFAULT_DELIVERY_MODE, 6, Message.DEFAULT_TIME_TO_LIVE);
-
- log("Sending normal message with priority 7");
- producer1.send(normalMsg, Message.DEFAULT_DELIVERY_MODE, 7, Message.DEFAULT_TIME_TO_LIVE);
-
- TextMessage message3 = session.createTextMessage(ORDERING_MSG3);
- log("Sending message3 with priority 5");
- producer.send(message3, Message.DEFAULT_DELIVERY_MODE, 8, Message.DEFAULT_TIME_TO_LIVE);
-
- log("The message was successfully sent to the " + queue.getQueueName() + " queue");
-
- connection.start();
- session.commit();
-
- ConsumerThread client1 = new ConsumerThread("Client-1", this, cf, queue);
- ConsumerThread client2 = new ConsumerThread("Client-2", this, cf, queue);
-
- client1.start();
- client2.start();
-
- client1.join();
- client2.join();
-
- checkResults();
-
- displayProviderInfo(connection.getMetaData());
-
- }
- finally
- {
- if(ic != null)
- {
- try
- {
- ic.close();
- }
- catch(Exception e)
- {
- throw e;
- }
- }
-
- // ALWAYS close your connection in a finally block to avoid leaks.
- // Closing connection also takes care of closing its related objects e.g. sessions.
- closeConnection(connection);
- }
- }
-
- private void closeConnection(Connection con)
- {
- try
- {
- if (con != null)
- {
- con.close();
- }
- }
- catch(JMSException jmse)
- {
- log("Could not close connection " + con +" exception was " + jmse);
- }
- }
-
- protected boolean isQueueExample()
- {
- return true;
- }
-
- public static void main(String[] args)
- {
- new OrderingGroupExample().run();
- }
-
- public void reportReceive(TextMessage msg) throws JMSException
- {
- synchronized(deliveryRecords)
- {
- deliveryRecords.add(msg.getText());
- }
- }
-
- public int getNumMessages()
- {
- return 5;
- }
-
-}
Copied: branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java (from rev 5331, branches/Branch_JBMESSAGING_1416/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java)
===================================================================
--- branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java (rev 0)
+++ branches/Branch_1416_merge/docs/examples/ordering-group-1/src/org/jboss/example/jms/ordering/OrderingGroupExample.java 2008-11-11 11:34:32 UTC (rev 5336)
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+package org.jboss.example.jms.ordering;
+
+import java.util.ArrayList;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Message;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.jms.client.JBossMessageProducer;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+ * session and a message producer, which sends a message to the queue "queue/testQueue". Then, the
+ * example uses the same connection to create a consumer that that reads a single message from the
+ * queue. The example is considered successful if the message consumer receives without any error
+ * the message that was sent by the producer.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: QueueExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class OrderingGroupExample extends ExampleSupport
+{
+ public static final String NORMAL_MSG = "Hello-normal";
+ public static final String NORMAL_MSG1 = "Hello-normal-1";
+ public static final String ORDERING_MSG1 = "Hello!";
+ public static final String ORDERING_MSG2 = "Hello-1!";
+ public static final String ORDERING_MSG3 = "Hello-2!";
+
+ private ArrayList<String> deliveryRecords = new ArrayList<String>();
+
+ private void checkResults() throws Exception
+ {
+ int len = deliveryRecords.size();
+ System.out.println("len: " + len);
+ if (len != 5)
+ {
+ System.err.println("=====Error, the len is not 5!=====");
+ }
+ int n1 = deliveryRecords.indexOf(ORDERING_MSG1);
+ int n2 = deliveryRecords.indexOf(ORDERING_MSG2);
+ int n3 = deliveryRecords.indexOf(ORDERING_MSG3);
+ System.out.println("n1: " + n1 + " n2: " + n2 + " n3: " + n3);
+ if ( (n1 < n2) && (n2 < n3) )
+ {
+ System.out.println("=====Correct=======");
+ }
+ else
+ {
+ System.err.println("=====Error======");
+ }
+ }
+
+ public boolean allReceived()
+ {
+ synchronized(deliveryRecords)
+ {
+ return deliveryRecords.size() == 5;
+ }
+ }
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+
+ JBossMessageProducer producer1 = (JBossMessageProducer)session.createProducer(queue);
+ TextMessage normalMsg = session.createTextMessage(NORMAL_MSG);
+ TextMessage normalMsg1 = session.createTextMessage(NORMAL_MSG1);
+
+ log("Sending mormal message with lower priority 1");
+ producer1.send(normalMsg1, Message.DEFAULT_DELIVERY_MODE, 1, Message.DEFAULT_TIME_TO_LIVE);
+
+ JBossMessageProducer producer = (JBossMessageProducer)session.createProducer(queue);
+ producer.enableOrderingGroup("MyOrderingGroup");
+
+ TextMessage message = session.createTextMessage(ORDERING_MSG1);
+ message.setJMSPriority(0);
+ log("Sending message with priority 0");
+ producer.send(message, Message.DEFAULT_DELIVERY_MODE, 5, Message.DEFAULT_TIME_TO_LIVE);
+
+ TextMessage message2 = session.createTextMessage(ORDERING_MSG2);
+ log("Sending message2 with priority 8");
+ producer.send(message2, Message.DEFAULT_DELIVERY_MODE, 6, Message.DEFAULT_TIME_TO_LIVE);
+
+ log("Sending normal message with priority 7");
+ producer1.send(normalMsg, Message.DEFAULT_DELIVERY_MODE, 7, Message.DEFAULT_TIME_TO_LIVE);
+
+ TextMessage message3 = session.createTextMessage(ORDERING_MSG3);
+ log("Sending message3 with priority 5");
+ producer.send(message3, Message.DEFAULT_DELIVERY_MODE, 8, Message.DEFAULT_TIME_TO_LIVE);
+
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection.start();
+ session.commit();
+
+ ConsumerThread client1 = new ConsumerThread("Client-1", this, cf, queue);
+ ConsumerThread client2 = new ConsumerThread("Client-2", this, cf, queue);
+
+ client1.start();
+ client2.start();
+
+ client1.join();
+ client2.join();
+
+ checkResults();
+
+ displayProviderInfo(connection.getMetaData());
+
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ // ALWAYS close your connection in a finally block to avoid leaks.
+ // Closing connection also takes care of closing its related objects e.g. sessions.
+ closeConnection(connection);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " + jmse);
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new OrderingGroupExample().run();
+ }
+
+ public void reportReceive(TextMessage msg) throws JMSException
+ {
+ synchronized(deliveryRecords)
+ {
+ deliveryRecords.add(msg.getText());
+ }
+ }
+
+ public int getNumMessages()
+ {
+ return 5;
+ }
+
+}
More information about the jboss-cvs-commits
mailing list