activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject [07/18] Porting apollo examples structure to ActiveMQ 5.9.
Date Thu, 10 Oct 2013 14:40:30 GMT
http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/exploring-jms/build.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/exploring-jms/build.xml b/assembly/src/release/examples/openwire/exploring-jms/build.xml
new file mode 100644
index 0000000..9318351
--- /dev/null
+++ b/assembly/src/release/examples/openwire/exploring-jms/build.xml
@@ -0,0 +1,334 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="JMS_Samples">
+
+   <property name="activemq.home" value="../../.." />
+
+   <property name="PTP1" value=".\QueuePTPSamples\QueueMonitor"/>
+   <property name="QMON" location=".\QueuePTPSamples\QueueMonitor\QueueMonitor.properties"/>
+   <property name="PTP2" value=".\QueuePTPSamples\QueueRoundTrip"/>
+   <property name="PTP3" value=".\QueuePTPSamples\RequestReply"/>
+   <property name="PTP4" value=".\QueuePTPSamples\SelectorTalk"/>
+   <property name="PTP5" value=".\QueuePTPSamples\Talk"/>
+   <property name="PTP6" value=".\QueuePTPSamples\TransactedTalk"/>
+   <property name="PS1" value=".\TopicPubSubSamples\Chat"/>
+   <property name="PS2" value=".\TopicPubSubSamples\DurableChat"/>
+   <property name="PS3" value=".\TopicPubSubSamples\HierarchicalChat"/>
+   <property name="PS4" value=".\TopicPubSubSamples\MessageMonitor"/>
+   <property name="PS5" value=".\TopicPubSubSamples\RequestReply"/>
+   <property name="PS6" value=".\TopicPubSubSamples\SelectorChat"/>
+   <property name="PS7" value=".\TopicPubSubSamples\TransactedChat"/>
+   
+   <property name="PUBSUB_SAMPLES" value="${PS1};${PS2};${PS3};${PS4};${PS5};${PS6};${PS7};"/>
+   
+   <property name="PTP_SAMPLES" value="${PTP1};${PTP2};${PTP3};${PTP4};${PTP5};${PTP6};"/>
+
+	<target name="init">
+		<path id="javac.classpath">
+			<pathelement path="conf" />
+			<fileset dir="../../../lib">
+				<include name="**/*.jar" />
+			</fileset>
+		</path>
+	</target>
+
+	<target name="compile" depends="init" description="Compile all Java">
+		<javac srcdir="${PTP1}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PTP2}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PTP3}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PTP4}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PTP5}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PTP6}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PS1}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PS2}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PS3}"><classpath refid="javac.classpath"/></javac>
+		<javac srcdir="${PS4}"><classpath refid="javac.classpath"/></javac>		
+		<javac srcdir="${PS5}"><classpath refid="javac.classpath"/></javac>		
+		<javac srcdir="${PS6}"><classpath refid="javac.classpath"/></javac>	
+		<javac srcdir="${PS7}"><classpath refid="javac.classpath"/></javac>
+	</target>
+
+   <target name="chat1" depends="compile">
+   	<java classname="Chat" fork="true">
+		   <classpath>
+             <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+
+   	       <arg value="-u"/>
+   	       <arg value="Chatter1"/>
+   	</java>
+   </target>
+   
+  <target name="chat2" depends="compile">
+   	<java classname="Chat" fork="true">
+		   <classpath>
+          	 <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	       <arg value="-u"/>
+   	       <arg value="Chatter2"/>
+   	</java>
+   </target>
+   
+  <target name="chat3" depends="compile">
+   	<java classname="Chat" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>   	       
+   		   <arg value="-u"/>
+   	       <arg value="Chatter3"/>
+   	</java>
+   </target>
+   
+  <target name="durable1" depends="compile">
+   	<java classname="DurableChat" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   		   <arg value="-u"/>
+   	       <arg value="DurableChatter_1"/>
+   	</java>
+   </target>
+   
+  <target name="durable2" depends="compile">
+   	<java classname="DurableChat" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>   		
+   	       <arg value="-u"/>
+   	       <arg value="DurableChatter_2"/>
+   	</java>
+   </target>
+
+  <target name="durable3" depends="compile">
+   	<java classname="DurableChat" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	       <arg value="-u"/>
+   	       <arg value="DurableChatter_3"/>
+   	</java>
+   </target>
+   
+  <target name="wildcard" depends="compile">
+   	<java classname="HierarchicalChat" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	       <arg value="-u"/>
+   	       <arg value="HierarchicalChatter"/>
+   	</java>
+   </target>
+   
+  <target name="tmonitor" depends="compile">
+   	<java classname="MessageMonitor" fork="true">
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>   	
+   	</java>
+   </target>
+   
+  <target name="filterchat1" depends="compile">
+   	<java classname="SelectorChat" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="SelectiveChatter_1"/>
+   	       <arg value="-s"/>
+   	       <arg value="SelectiveChatter_1"/>
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	</java>
+   </target>
+   
+  <target name="filterchat2" depends="compile">
+   	<java classname="SelectorChat" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="SelectiveChatter_2"/>
+   	       <arg value="-s"/>
+   	       <arg value="2"/>
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	</java>
+   </target>
+   
+  <target name="xnchat" depends="compile">
+   	<java classname="TransactedChat" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="TransactedChatter"/>
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath>
+   	</java>
+   </target>
+   
+  <target name="talk1" depends="compile">
+   	<java classname="Talk" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="Talker_1"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q1"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q2"/>
+		   <classpath>
+       	     <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath>
+   	</java>
+   </target>
+   
+  <target name="talk2" depends="compile">
+   	<java classname="Talk" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="Talker_2"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q2"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q1"/>
+		   <classpath>
+    	     <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath>   		
+   	</java>
+   </target>
+   
+  <target name="talk3" depends="compile">
+   	<java classname="Talk" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="Talker_3"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q3"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q1"/>
+		   <classpath>
+ 	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="qmonitor" depends="compile">
+   	<java classname="QueueMonitor" fork="true">
+		   <classpath>
+ 	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="filtertalk1" depends="compile">
+   	<java classname="SelectorTalk" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="SelectiveTalker_1"/>
+   	       <arg value="-s"/>
+   	       <arg value="1"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q1"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q1"/>
+		   <classpath>
+ 	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="filtertalk2" depends="compile">
+   	<java classname="SelectorTalk" fork="true">
+   	       <arg value="-u"/>
+   	       <arg value="SelectiveTalker_2"/>
+   	       <arg value="-s"/>
+   	       <arg value="2"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q1"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q1"/>
+		   <classpath>
+ 	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="xntalk" depends="compile">
+   	<java classname="TransactedTalk" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="TransactedTalker"/>
+   	       <arg value="-qs"/>
+   	       <arg value="Q1"/>
+   	       <arg value="-qr"/>
+   	       <arg value="Q2"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="qreply" depends="compile">
+   	<java classname="Replier" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="ReplyingTalker"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="qrequest" depends="compile">
+   	<java classname="Requestor" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="RequestingTalker"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="treply" depends="compile">
+   	<java classname="TopicReplier" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="ReplyingChatter"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="trequest" depends="compile">
+   	<java classname="TopicRequestor" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="RequestingChatter"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PUBSUB_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>
+   
+  <target name="roundtrip" depends="compile">
+   	<java classname="QueueRoundTrip" fork="true" classpath="${javac.classpath}">
+   	       <arg value="-u"/>
+   	       <arg value="QueueRoundTrip"/>
+   	       <arg value="-n"/>
+   	       <arg value="10000"/>
+		   <classpath>
+	         <path refid="javac.classpath"/>
+             <pathelement path="${PTP_SAMPLES}"/>
+           </classpath> 
+   	</java>
+   </target>	
+	
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/exploring-jms/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/exploring-jms/conf/log4j.properties b/assembly/src/release/examples/openwire/exploring-jms/conf/log4j.properties
new file mode 100644
index 0000000..e5326c5
--- /dev/null
+++ b/assembly/src/release/examples/openwire/exploring-jms/conf/log4j.properties
@@ -0,0 +1,39 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used by the standalone ActiveMQ broker
+#
+log4j.rootLogger=INFO, stdout, logfile
+
+# CONSOLE appender
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n
+
+# Log File appender
+log4j.appender.logfile=org.apache.log4j.FileAppender
+log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
+log4j.appender.logfile.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.logfile.file=activemq.log
+log4j.appender.logfile.append=true
+
+#
+#  You can change logger levels here.
+#
+log4j.logger.org.apache.activemq=INFO
+log4j.logger.org.apache.activemq.spring=WARN

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/exploring-jms/readme.txt
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/exploring-jms/readme.txt b/assembly/src/release/examples/openwire/exploring-jms/readme.txt
new file mode 100644
index 0000000..3296f92
--- /dev/null
+++ b/assembly/src/release/examples/openwire/exploring-jms/readme.txt
@@ -0,0 +1,10 @@
+FuseSource distribution of ActiveMQ - Exploring JMS v1.1
+========================================================
+The Exploring JMS Samples are a described in the "Exploring JMS with 
+the FuseSource distribution of ActiveMQ" book available from fusesource.com.
+
+They demonstrate how to use the JMS client APIs to accomplish basic messaging 
+tasks.
+
+The build.xml file provides targets for rebuilding the examples and for 
+launching them.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/java/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/java/pom.xml b/assembly/src/release/examples/openwire/java/pom.xml
new file mode 100644
index 0000000..0e7a500
--- /dev/null
+++ b/assembly/src/release/examples/openwire/java/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>example</groupId>
+  <artifactId>openwire-example</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  
+  <name>example</name>
+  <description>ActiveMQ Openwire Java Examples</description>
+
+  <repositories>
+    <repository>
+      <id>Fusesource Snapshots</id>
+      <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
+    </repository>
+  </repositories>
+    
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jms_1.1_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-client</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-nop</artifactId>
+      <version>${slf4j-version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.1</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+
+      <!-- include all the dependencies into the jar so it's easier to execute the example -->
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-uberize-plugin</artifactId>
+        <version>1.14</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals><goal>uberize</goal></goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+    </plugins>
+  </build>
+  
+</project>
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/java/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/java/readme.md b/assembly/src/release/examples/openwire/java/readme.md
new file mode 100644
index 0000000..ad23ad7
--- /dev/null
+++ b/assembly/src/release/examples/openwire/java/readme.md
@@ -0,0 +1,32 @@
+## Overview
+
+This is an example of how use the Java JMS api with ActiveMQ.
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    java -cp target/openwire-example-0.1-SNAPSHOT.jar example.Listener
+
+In another terminal window run:
+
+    java -cp target/openwire-example-0.1-SNAPSHOT.jar example.Publisher
+
+You can control to which server the examples try to connect to by
+setting the following environment variables: 
+
+* `ACTIVEMQ_HOST`
+* `ACTIVEMQ_PORT`
+* `ACTIVEMQ_USER`
+* `ACTIVEMQ_PASSWORD`

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/java/src/main/java/example/Listener.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/java/src/main/java/example/Listener.java b/assembly/src/release/examples/openwire/java/src/main/java/example/Listener.java
new file mode 100644
index 0000000..eab887d
--- /dev/null
+++ b/assembly/src/release/examples/openwire/java/src/main/java/example/Listener.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package example;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQTopic;
+
+import javax.jms.*;
+
+class Listener {
+
+    public static void main(String []args) throws JMSException {
+
+        String user = env("ACTIVEMQ_USER", "admin");
+        String password = env("ACTIVEMQ_PASSWORD", "password");
+        String host = env("ACTIVEMQ_HOST", "localhost");
+        int port = Integer.parseInt(env("ACTIVEMQ_PORT", "61616"));
+        String destination = arg(args, 0, "event");
+
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://" + host + ":" + port);
+
+        Connection connection = factory.createConnection(user, password);
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination dest = new ActiveMQTopic(destination);
+
+        MessageConsumer consumer = session.createConsumer(dest);
+        long start = System.currentTimeMillis();
+        long count = 1;
+        System.out.println("Waiting for messages...");
+        while(true) {
+            Message msg = consumer.receive();
+            if( msg instanceof  TextMessage ) {
+                String body = ((TextMessage) msg).getText();
+                if( "SHUTDOWN".equals(body)) {
+                    long diff = System.currentTimeMillis() - start;
+                    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();
+                    }
+                    if( count % 1000 == 0 ) {
+                        System.out.println(String.format("Received %d messages.", count));
+                    }
+                    count ++;
+                }
+
+            } else {
+                System.out.println("Unexpected message type: "+msg.getClass());
+            }
+        }
+        connection.close();
+    }
+
+    private static String env(String key, String defaultValue) {
+        String rc = System.getenv(key);
+        if( rc== null )
+            return defaultValue;
+        return rc;
+    }
+
+    private static String arg(String []args, int index, String defaultValue) {
+        if( index < args.length )
+            return args[index];
+        else
+            return defaultValue;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/java/src/main/java/example/Publisher.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/java/src/main/java/example/Publisher.java b/assembly/src/release/examples/openwire/java/src/main/java/example/Publisher.java
new file mode 100644
index 0000000..4f2b4f4
--- /dev/null
+++ b/assembly/src/release/examples/openwire/java/src/main/java/example/Publisher.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package example;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQTopic;
+
+import javax.jms.*;
+
+class Publisher {
+
+    public static void main(String []args) throws JMSException {
+
+        String user = env("ACTIVEMQ_USER", "admin");
+        String password = env("ACTIVEMQ_PASSWORD", "password");
+        String host = env("ACTIVEMQ_HOST", "localhost");
+        int port = Integer.parseInt(env("ACTIVEMQ_PORT", "61616"));
+        String destination = arg(args, 0, "event");
+
+        int messages = 10000;
+        int size = 256;
+
+        String DATA = "abcdefghijklmnopqrstuvwxyz";
+        String body = "";
+        for( int i=0; i < size; i ++) {
+            body += DATA.charAt(i%DATA.length());
+        }
+
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://" + host + ":" + port);
+
+        Connection connection = factory.createConnection(user, password);
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination dest = new ActiveMQTopic(destination);
+        MessageProducer producer = session.createProducer(dest);
+        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+        for( int i=1; i <= messages; i ++) {
+            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));
+            }
+        }
+
+        producer.send(session.createTextMessage("SHUTDOWN"));
+        connection.close();
+
+    }
+
+    private static String env(String key, String defaultValue) {
+        String rc = System.getenv(key);
+        if( rc== null )
+            return defaultValue;
+        return rc;
+    }
+
+    private static String arg(String []args, int index, String defaultValue) {
+        if( index < args.length )
+            return args[index];
+        else
+            return defaultValue;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/build.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/build.xml b/assembly/src/release/examples/openwire/swissarmy/build.xml
new file mode 100755
index 0000000..f2aba5d
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/build.xml
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project name="Inbox" default="help" basedir=".">
+
+    <property name="class.dir" value="target/classes" />
+    <property name="activemq.home" value=".." />
+
+    <!-- example program defaults -->
+    <property name="url" value="tcp://localhost:61616" />
+    <property name="topic" value="false" />
+    <property name="subject" value="TEST.FOO" />
+    <property name="durable" value="false" />
+    <property name="max" value="2000" />
+    <property name="parallelThreads" value="1" />
+    <property name="messageSize" value="1000" />
+    <property name="clientId" value="consumer1" />
+    <property name="producerClientId" value="null" />
+    <property name="timeToLive" value="0" />
+    <property name="sleepTime" value="0" />
+    <property name="transacted" value="false" />
+    <property name="reply-subject" value="" />
+    <property name="verbose" value="true"/>
+    <property name="ack-mode" value="AUTO_ACKNOWLEDGE"/>
+    <property name="receive-time-out" value="0"/>
+    <property name="subscribers" value="1"/>
+    <property name="batch" value="10"/>
+    <property name="user" value=""/>
+    <property name="password" value=""/>
+
+    <!-- for WAR -->
+    <property name="app.name" value="activemq-web" />
+    <property name="app.base.dir" location="target/${app.name}" />
+    <property name="app.webinf.dir" value="${app.base.dir}/WEB-INF" />
+    <property name="app.classes.dir" value="${app.webinf.dir}/classes" />
+    <property name="app.lib.dir" value="${app.webinf.dir}/lib" />
+    <property name="app.src.dir" value="src" />
+    <property name="app.conf.dir" value="conf" />
+    <property name="app.dist.dir" value="target" />
+
+
+    <target name="help">
+        <echo>
+            This script requires Ant 1.6 or higher
+
+            NOTE: All options should be specified as system properties
+               on the command line, e.g.:
+
+               ant consumer -Durl=tcp://hostname:1234 -Dtopic=true
+
+                 OR
+
+               ant producer -Durl=tcp://hostname:61616 -Dmax=1000
+
+            Usage:
+              ant &lt;ant-task> &lt;options>
+
+            --------------------------------------------------------
+            ant consumer &lt;options> - Creates a consumer which waits until a specific number
+                                     of messages have been received
+
+            Consumer Options:
+                              url - Used to specify acustom URL for the
+                                    broker, e.g., tcp://hostname:1234
+                            topic - A boolean to determine whether to use
+                                    topics or queues; the default is false
+                          subject - Used to specify a custom destination
+                                    name, e.g. MyDestination
+                          durable - A boolean to specify that you want to
+                                    create a durable topic?
+                              max - The maximum number of messages to wait
+                                    for before shutting down
+                         clientId - A string to use as the client id
+                       transacted - A boolean to specify that you want to use
+                                    transactions?
+                        sleepTime - The time to sleep between message consumptions
+                          verbose - Used to print out more info; the default is
+                                    true
+                         ack-mode - The type of message acknowledgement to use;
+                                    see the Javadocs for javax.jms.Session for
+                                    more information
+                 receive-time-out - An integer to specify the time to wait for
+                                    message consumption
+                  parallelThreads - The number of parallel threads
+                            batch - Batch size for transactions and client acknowledgment (default 10)
+                             user - Connection username (if connecting to secured broker)
+                         password - Connection password (if connecting to secured broker)
+
+            --------------------------------------------------------
+            ant producer &lt;options&gt; - Creates a producer publishing a number of messages
+
+            Producer Options:
+                           url - Used to specify acustom URL for the broker,
+                                 e.g., tcp://hostname:1234
+                         topic - A boolean to determine whether to use topics
+                                 or queues
+                       subject - Used to specify a custom destination name,
+                                 e.g. MyDestination
+                       durable - A boolean to specify that you want to change the DeliveryMode of
+                                 the produced messages ('PERSISTENT':'true' or 'NON-PERSISTENT':'false')
+                           max - The maximum number of messages to wait for
+                                 before shutting down
+                     sleepTime - The time to sleep between message consumptions
+                    transacted - A boolean to specify that you want to use
+                                 transactions?
+                       verbose - Used to print out more info; the default is true
+                   messageSize - The size of the message in 1-byte characters
+               parallelThreads - The number of parallel threads
+                         batch - Batch size for transactions and client acknowledgment (default 10)
+                          user - Connection username (if connecting to secured broker)
+                      password - Connection password (if connecting to secured broker)
+
+           --------------------------------------------------------
+
+                   ant -help  - Display ant help screen
+                    ant help  - Display this message
+                   ant clean  - Delete the built directory
+             ant embedBroker  - Runs an embedded broker inside Java code
+                     ant war  - Creates a WAR deployment unit of the ActiveMQ Broker
+    </echo>
+    </target>
+
+    <target name="clean">
+        <delete dir="target" quiet="true" />
+        <delete dir="${class.dir}" quiet="true" />
+    </target>
+
+    <target name="init">
+        <mkdir dir="${class.dir}" />
+        <mkdir dir="src/ddl" />
+
+        <path id="javac.classpath">
+            <pathelement path="${class.dir}" />
+            <pathelement path="conf" />
+            <fileset dir="../../../lib">
+                <include name="**/*.jar" />
+            </fileset>
+        </path>
+    </target>
+
+
+    <target name="compile" depends="init" description="Compile all Java">
+        <javac srcdir="src" destdir="${class.dir}" includeantruntime="false">
+            <classpath refid="javac.classpath" />
+        </javac>
+        <copy todir="${class.dir}">
+            <fileset dir="src">
+                <include name="**/*.properties" />
+                <include name="**/*.xml" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="war" depends="compile" description="Create the activemq broker war file.">
+        <!--Copy the required jar files-->
+        <copy todir="${app.lib.dir}">
+            <fileset dir="../../../lib">
+                <include name="*.jar" />
+                <exclude name="servlet.jar" />
+            </fileset>
+
+            <fileset dir="../../../lib/optional">
+                <include name="activemq-web*.jar" />
+                <include name="activemq-container*.jar" />
+                <include name="commons-bean*.jar" />
+                <include name="spring*.jar" />
+                <include name="xbean*.jar" />
+
+                <!-- include Apache Derby for persistence -->
+                <include name="derby*.jar" />
+
+                <!-- include database pooling just in case -->
+                <include name="commons-pool*.jar" />
+                <include name="commons-db*.jar" />
+            </fileset>
+        </copy>
+        <!--Copy the configuration file-->
+        <copy todir="${app.webinf.dir}">
+            <fileset dir="${app.conf.dir}">
+                <!--Web application configuration file-->
+                <include name="web.xml" />
+                <!--ActiveMQ configuration file-->
+                <include name="activemq.xml" />
+            </fileset>
+        </copy>
+        <copy todir="${app.classes.dir}">
+            <fileset dir="${app.conf.dir}">
+                <!--Log4j configuration file-->
+                <include name="log4j.properties" />
+            </fileset>
+        </copy>
+        <!-- Create the war file -->
+        <jar jarfile="${app.dist.dir}/${app.name}.war" basedir="${app.base.dir}" />
+    </target>
+
+    <target name="consumer" depends="compile" description="Runs a simple consumer">
+
+        <echo>Running consumer against server at $$url = ${url} for subject $$subject = ${subject}</echo>
+        <java classname="ConsumerTool" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <sysproperty key="activemq.home" value="${activemq.home}"/>
+            <arg value="--url=${url}" />
+            <arg value="--topic=${topic}" />
+            <arg value="--subject=${subject}" />
+            <arg value="--durable=${durable}" />
+            <arg value="--maxium-messages=${max}" />
+            <arg value="--client-id=${clientId}" />
+            <arg value="--parallel-threads=${parallelThreads}" />
+            <arg value="--transacted=${transacted}" />
+            <arg value="--sleep-time=${sleepTime}" />
+            <arg value="--verbose=${verbose}"/>
+            <arg value="--ack-mode=${ack-mode}"/>
+            <arg value="--receive-time-out=${receive-time-out}"/>
+      <arg value="--batch=${batch}"/>
+      <arg value="--user=${user}"/>
+      <arg value="--password=${password}"/>
+        </java>
+    </target>
+
+    <target name="producer" depends="compile" description="Runs a simple producer">
+
+        <echo>Running producer against server at $$url = ${url} for subject $$subject = ${subject}</echo>
+        <java classname="ProducerTool" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <sysproperty key="activemq.home" value="${activemq.home}"/>
+            <arg value="--url=${url}" />
+            <arg value="--topic=${topic}" />
+            <arg value="--subject=${subject}" />
+            <arg value="--persistent=${durable}" />
+            <arg value="--message-count=${max}" />
+            <arg value="--message-size=${messageSize}" />
+            <arg value="--parallel-threads=${parallelThreads}" />
+            <arg value="--time-to-live=${timeToLive}" />
+            <arg value="--sleep-time=${sleepTime}" />
+            <arg value="--transacted=${transacted}" />
+            <arg value="--verbose=${verbose}"/>
+      <arg value="--batch=${batch}"/>
+      <arg value="--user=${user}"/>
+      <arg value="--password=${password}"/>
+        </java>
+    </target>
+
+    <target name="requester" depends="compile" description="Runs a simple requester">
+
+        <echo>Running requester against server at $$url = ${url} for subject $$subject = ${subject}</echo>
+        <java classname="RequesterTool" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <sysproperty key="activemq.home" value="${activemq.home}"/>
+            <arg value="--url=${url}" />
+            <arg value="--topic=${topic}" />
+            <arg value="--subject=${subject}" />
+            <arg value="--persistent=${durable}" />
+            <arg value="--message-count=${max}" />
+            <arg value="--message-size=${messageSize}" />
+            <arg value="--client-id=${producerClientId}" />
+            <arg value="--time-to-live=${timeToLive}" />
+            <arg value="--sleep-time=${sleepTime}" />
+            <arg value="--transacted=${transacted}" />
+            <arg value="--reply-subject=${reply-subject}" />
+            <arg value="--verbose=${verbose}"/>
+        </java>
+    </target>
+
+    <target name="embedBroker" depends="compile" description="Runs a simple producer">
+
+        <echo>Running an embedded broker example</echo>
+        <java classname="EmbeddedBroker" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <sysproperty key="activemq.home" value="${activemq.home}"/>
+        </java>
+    </target>
+
+    <target name="topic-publisher" depends="compile" description="Runs a publisher">
+        <java classname="TopicPublisher" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <arg value="--url=${url}" />
+            <arg value="--size=${messageSize}" />
+            <arg value="--subscribers=${subscribers}" />
+            <arg value="--messages=${max}" />
+            <arg value="--delay=${sleepTime}" />
+            <arg value="--batch=${batch}" />
+        </java>
+    </target>
+
+    <target name="topic-listener" depends="compile" description="Runs a listener">
+        <java classname="TopicListener" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+            <arg value="--url=${url}" />
+        </java>
+    </target>
+
+    <target name="stomp" depends="compile" description="Runs a Stomp example">
+        <echo>Running a Stomp example</echo>
+        <java classname="StompExample" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-server" />
+        </java>
+    </target>
+
+    <target name="log4j-jms" depends="compile" description="Runs a Log4j JMS Appender example">
+        <echo>Running a Log4j JMS Appender example</echo>
+        <java classname="Log4jJMSAppenderExample" fork="yes" maxmemory="100M">
+            <classpath refid="javac.classpath" />
+            <jvmarg value="-Dlog4j.configuration=log4j-jms.properties" />
+        </java>
+    </target>
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/readme.md b/assembly/src/release/examples/openwire/swissarmy/readme.md
new file mode 100644
index 0000000..0f3d709
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/readme.md
@@ -0,0 +1,32 @@
+# Overview
+
+Before running the examples you should start ActiveMQ on your machine. Follow the 
+installation instructions to use a binary distribution of ActiveMQ. To run the broker 
+in a command shell, type: 
+
+    bin/activemq
+
+This starts up the ActiveMQ broker. 
+
+h3. Running the examples from a binary distro
+
+You can use [Ant](http://ant.apache.org) to compile and run the examples. To run a 
+message producer run: 
+
+    ant producer
+
+To run a consumer, in another shell run: 
+
+    ant consumer
+
+You should then see messages being produced and consumed. You can also pass additional 
+commands into these goals using variables that are available in the build.xml. Below 
+is an example: 
+
+    ant consumer -Durl=tcp://localhost:61616 -Dtopic=true -Ddurable=true -Dmax=5000
+    ant producer -Durl=tcp://localhost:61616 -Dtopic=true -DtimeToLive=30000 -Dmax=5000
+
+For a summary of all the available goals and options try: 
+
+    ant help
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/CommandLineSupport.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/CommandLineSupport.java b/assembly/src/release/examples/openwire/swissarmy/src/CommandLineSupport.java
new file mode 100644
index 0000000..cbde8a4
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/CommandLineSupport.java
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+
+import org.apache.activemq.util.IntrospectionSupport;
+
+/**
+ * Helper utility that can be used to set the properties on any object using
+ * command line arguments.
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public final class CommandLineSupport {
+
+    private CommandLineSupport() {
+    }
+    
+    /**
+     * Sets the properties of an object given the command line args.
+     * 
+     * if args contains: --ack-mode=AUTO --url=tcp://localhost:61616 --persistent 
+     * 
+     * then it will try to call the following setters on the target object.
+     * 
+     * target.setAckMode("AUTO");
+     * target.setURL(new URI("tcp://localhost:61616") );
+     * target.setPersistent(true);
+     * 
+     * Notice the the proper conversion for the argument is determined by examining the 
+     * setter arguement type.  
+     * 
+     * @param target the object that will have it's properties set
+     * @param args the commline options
+     * @return any arguments that are not valid options for the target
+     */
+    public static String[] setOptions(Object target, String[] args) {
+        ArrayList<String> rc = new ArrayList<String>();
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i] == null) {
+                continue;
+            }
+
+            if (args[i].startsWith("--")) {
+
+                // --options without a specified value are considered boolean
+                // flags that are enabled.
+                String value = "true";
+                String name = args[i].substring(2);
+
+                // if --option=value case
+                int p = name.indexOf("=");
+                if (p > 0) {
+                    value = name.substring(p + 1);
+                    name = name.substring(0, p);
+                }
+
+                // name not set, then it's an unrecognized option
+                if (name.length() == 0) {
+                    rc.add(args[i]);
+                    continue;
+                }
+
+                String propName = convertOptionToPropertyName(name);
+                if (!IntrospectionSupport.setProperty(target, propName, value)) {
+                    rc.add(args[i]);
+                    continue;
+                }
+            }
+
+        }
+
+        String r[] = new String[rc.size()];
+        rc.toArray(r);
+        return r;
+    }
+
+    /**
+     * converts strings like: test-enabled to testEnabled
+     * 
+     * @param name
+     * @return
+     */
+    private static String convertOptionToPropertyName(String name) {
+        String rc = "";
+
+        // Look for '-' and strip and then convert the subsequent char to
+        // uppercase
+        int p = name.indexOf("-");
+        while (p > 0) {
+            // strip
+            rc += name.substring(0, p);
+            name = name.substring(p + 1);
+
+            // can I convert the next char to upper?
+            if (name.length() > 0) {
+                rc += name.substring(0, 1).toUpperCase();
+                name = name.substring(1);
+            }
+
+            p = name.indexOf("-");
+        }
+        return rc + name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/ConsumerTool.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/ConsumerTool.java b/assembly/src/release/examples/openwire/swissarmy/src/ConsumerTool.java
new file mode 100755
index 0000000..e8f39f7
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/ConsumerTool.java
@@ -0,0 +1,353 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+/**
+ * A simple tool for consuming messages
+ * 
+ * 
+ */
+public class ConsumerTool extends Thread implements MessageListener, ExceptionListener {
+
+    private boolean running;
+
+    private Session session;
+    private Destination destination;
+    private MessageProducer replyProducer;
+
+    private boolean pauseBeforeShutdown = false;
+    private boolean verbose = true;
+    private int maxiumMessages;
+    private static int parallelThreads = 1;
+    private String subject = "TOOL.DEFAULT";
+    private boolean topic;
+    private String user = ActiveMQConnection.DEFAULT_USER;
+    private String password = ActiveMQConnection.DEFAULT_PASSWORD;
+    private String url = ActiveMQConnection.DEFAULT_BROKER_URL;
+    private boolean transacted;
+    private boolean durable;
+    private String clientId;
+    private int ackMode = Session.AUTO_ACKNOWLEDGE;
+    private String consumerName = "James";
+    private long sleepTime;
+    private long receiveTimeOut;
+	private long batch = 10; // Default batch size for CLIENT_ACKNOWLEDGEMENT or SESSION_TRANSACTED
+	private long messagesReceived = 0;
+
+    public static void main(String[] args) {
+        ArrayList<ConsumerTool> threads = new ArrayList();
+        ConsumerTool consumerTool = new ConsumerTool();
+        String[] unknown = CommandLineSupport.setOptions(consumerTool, args);
+        if (unknown.length > 0) {
+            System.out.println("Unknown options: " + Arrays.toString(unknown));
+            System.exit(-1);
+        }
+        consumerTool.showParameters();
+        for (int threadCount = 1; threadCount <= parallelThreads; threadCount++) {
+            consumerTool = new ConsumerTool();
+            CommandLineSupport.setOptions(consumerTool, args);
+            consumerTool.start();
+            threads.add(consumerTool);
+        }
+
+        while (true) {
+            Iterator<ConsumerTool> itr = threads.iterator();
+            int running = 0;
+            while (itr.hasNext()) {
+                ConsumerTool thread = itr.next();
+                if (thread.isAlive()) {
+                    running++;
+                }
+            }
+
+            if (running <= 0) {
+                System.out.println("All threads completed their work");
+                break;
+            }
+
+            try {
+                Thread.sleep(1000);
+            } catch (Exception e) {
+            }
+        }
+        Iterator<ConsumerTool> itr = threads.iterator();
+        while (itr.hasNext()) {
+            ConsumerTool thread = itr.next();
+        }
+    }
+
+    public void showParameters() {
+        System.out.println("Connecting to URL: " + url + " (" + user + ":" + password + ")");
+        System.out.println("Consuming " + (topic ? "topic" : "queue") + ": " + subject);
+        System.out.println("Using a " + (durable ? "durable" : "non-durable") + " subscription");
+        System.out.println("Running " + parallelThreads + " parallel threads");
+    }
+
+    public void run() {
+        try {
+            running = true;
+
+            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
+            Connection connection = connectionFactory.createConnection();
+            if (durable && clientId != null && clientId.length() > 0 && !"null".equals(clientId)) {
+                connection.setClientID(clientId);
+            }
+            connection.setExceptionListener(this);
+            connection.start();
+
+            session = connection.createSession(transacted, ackMode);
+            if (topic) {
+                destination = session.createTopic(subject);
+            } else {
+                destination = session.createQueue(subject);
+            }
+
+            replyProducer = session.createProducer(null);
+            replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+            MessageConsumer consumer = null;
+            if (durable && topic) {
+                consumer = session.createDurableSubscriber((Topic) destination, consumerName);
+            } else {
+                consumer = session.createConsumer(destination);
+            }
+
+            if (maxiumMessages > 0) {
+                consumeMessagesAndClose(connection, session, consumer);
+            } else {
+                if (receiveTimeOut == 0) {
+                    consumer.setMessageListener(this);
+                } else {
+                    consumeMessagesAndClose(connection, session, consumer, receiveTimeOut);
+                }
+            }
+
+        } catch (Exception e) {
+            System.out.println("[" + this.getName() + "] Caught: " + e);
+            e.printStackTrace();
+        }
+    }
+
+    public void onMessage(Message message) {
+
+		messagesReceived++;
+
+        try {
+
+            if (message instanceof TextMessage) {
+                TextMessage txtMsg = (TextMessage) message;
+                if (verbose) {
+
+                    String msg = txtMsg.getText();
+                    int length = msg.length();
+                    if (length > 50) {
+                        msg = msg.substring(0, 50) + "...";
+                    }
+                    System.out.println("[" + this.getName() + "] Received: '" + msg + "' (length " + length + ")");
+                }
+            } else {
+                if (verbose) {
+                    System.out.println("[" + this.getName() + "] Received: '" + message + "'");
+                }
+            }
+
+            if (message.getJMSReplyTo() != null) {
+                replyProducer.send(message.getJMSReplyTo(), session.createTextMessage("Reply: " + message.getJMSMessageID()));
+            }
+
+            if (transacted) {
+				if ((messagesReceived % batch) == 0) {
+					System.out.println("Commiting transaction for last " + batch + " messages; messages so far = " + messagesReceived);
+					session.commit();
+				}
+            } else if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
+				if ((messagesReceived % batch) == 0) {
+					System.out.println("Acknowledging last " + batch + " messages; messages so far = " + messagesReceived);
+					message.acknowledge();
+				}
+            }
+
+        } catch (JMSException e) {
+            System.out.println("[" + this.getName() + "] Caught: " + e);
+            e.printStackTrace();
+        } finally {
+            if (sleepTime > 0) {
+                try {
+                    Thread.sleep(sleepTime);
+                } catch (InterruptedException e) {
+                }
+            }
+        }
+    }
+
+    public synchronized void onException(JMSException ex) {
+        System.out.println("[" + this.getName() + "] JMS Exception occured.  Shutting down client.");
+        running = false;
+    }
+
+    synchronized boolean isRunning() {
+        return running;
+    }
+
+    protected void consumeMessagesAndClose(Connection connection, Session session, MessageConsumer consumer) throws JMSException,
+            IOException {
+        System.out.println("[" + this.getName() + "] We are about to wait until we consume: " + maxiumMessages
+                + " message(s) then we will shutdown");
+
+        for (int i = 0; i < maxiumMessages && isRunning();) {
+            Message message = consumer.receive(1000);
+            if (message != null) {
+                i++;
+                onMessage(message);
+            }
+        }
+        System.out.println("[" + this.getName() + "] Closing connection");
+        consumer.close();
+        session.close();
+        connection.close();
+        if (pauseBeforeShutdown) {
+            System.out.println("[" + this.getName() + "] Press return to shut down");
+            System.in.read();
+        }
+    }
+
+    protected void consumeMessagesAndClose(Connection connection, Session session, MessageConsumer consumer, long timeout)
+            throws JMSException, IOException {
+        System.out.println("[" + this.getName() + "] We will consume messages while they continue to be delivered within: " + timeout
+                + " ms, and then we will shutdown");
+
+        Message message;
+        while ((message = consumer.receive(timeout)) != null) {
+            onMessage(message);
+        }
+
+        System.out.println("[" + this.getName() + "] Closing connection");
+        consumer.close();
+        session.close();
+        connection.close();
+        if (pauseBeforeShutdown) {
+            System.out.println("[" + this.getName() + "] Press return to shut down");
+            System.in.read();
+        }
+    }
+
+    public void setAckMode(String ackMode) {
+        if ("CLIENT_ACKNOWLEDGE".equals(ackMode)) {
+            this.ackMode = Session.CLIENT_ACKNOWLEDGE;
+        }
+        if ("AUTO_ACKNOWLEDGE".equals(ackMode)) {
+            this.ackMode = Session.AUTO_ACKNOWLEDGE;
+        }
+        if ("DUPS_OK_ACKNOWLEDGE".equals(ackMode)) {
+            this.ackMode = Session.DUPS_OK_ACKNOWLEDGE;
+        }
+        if ("SESSION_TRANSACTED".equals(ackMode)) {
+            this.ackMode = Session.SESSION_TRANSACTED;
+        }
+    }
+
+    public void setClientId(String clientID) {
+        this.clientId = clientID;
+    }
+
+    public void setConsumerName(String consumerName) {
+        this.consumerName = consumerName;
+    }
+
+    public void setDurable(boolean durable) {
+        this.durable = durable;
+    }
+
+    public void setMaxiumMessages(int maxiumMessages) {
+        this.maxiumMessages = maxiumMessages;
+    }
+
+    public void setPauseBeforeShutdown(boolean pauseBeforeShutdown) {
+        this.pauseBeforeShutdown = pauseBeforeShutdown;
+    }
+
+    public void setPassword(String pwd) {
+        this.password = pwd;
+    }
+
+    public void setReceiveTimeOut(long receiveTimeOut) {
+        this.receiveTimeOut = receiveTimeOut;
+    }
+
+    public void setSleepTime(long sleepTime) {
+        this.sleepTime = sleepTime;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public void setParallelThreads(int parallelThreads) {
+        if (parallelThreads < 1) {
+            parallelThreads = 1;
+        }
+        this.parallelThreads = parallelThreads;
+    }
+
+    public void setTopic(boolean topic) {
+        this.topic = topic;
+    }
+
+    public void setQueue(boolean queue) {
+        this.topic = !queue;
+    }
+
+    public void setTransacted(boolean transacted) {
+        this.transacted = transacted;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    public void setBatch(long batch) {
+        this.batch = batch;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/EmbeddedBroker.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/EmbeddedBroker.java b/assembly/src/release/examples/openwire/swissarmy/src/EmbeddedBroker.java
new file mode 100644
index 0000000..d45ceff
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/EmbeddedBroker.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.activemq.broker.BrokerService;
+
+/**
+ * This example demonstrates how to run an embedded broker inside your Java code
+ * 
+ * 
+ */
+public final class EmbeddedBroker {
+
+    private EmbeddedBroker() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        BrokerService broker = new BrokerService();
+        broker.setUseJmx(true);
+        broker.addConnector("tcp://localhost:61616");
+        broker.start();
+
+        // now lets wait forever to avoid the JVM terminating immediately
+        Object lock = new Object();
+        synchronized (lock) {
+            lock.wait();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/Log4jJMSAppenderExample.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/Log4jJMSAppenderExample.java b/assembly/src/release/examples/openwire/swissarmy/src/Log4jJMSAppenderExample.java
new file mode 100644
index 0000000..657b9b2
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/Log4jJMSAppenderExample.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.command.ActiveMQObjectMessage;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+
+
+/**
+ * A simple example of log4j jms appender in conjuction with ActiveMQ
+ */
+public class Log4jJMSAppenderExample implements MessageListener {
+
+	public Log4jJMSAppenderExample() throws Exception {
+		// create a logTopic topic consumer
+		ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
+		Connection conn = factory.createConnection();
+		Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+		conn.start();
+		MessageConsumer consumer = sess.createConsumer(sess.createTopic("logTopic"));
+		consumer.setMessageListener(this);
+		// log a message
+		Logger log = Logger.getLogger(Log4jJMSAppenderExample.class);
+		log.info("Test log");
+		// clean up
+		Thread.sleep(1000);
+		consumer.close();
+		sess.close();
+		conn.close();
+		System.exit(1);
+	}
+	
+	public static void main(String[] args) throws Exception {
+		new Log4jJMSAppenderExample();
+	}
+
+	public void onMessage(Message message) {
+		try {
+			// receive log event in your consumer
+			LoggingEvent event = (LoggingEvent)((ActiveMQObjectMessage)message).getObject();
+			System.out.println("Received log [" + event.getLevel() + "]: "+ event.getMessage());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	
+	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/ProducerAndConsumerTool.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/ProducerAndConsumerTool.java b/assembly/src/release/examples/openwire/swissarmy/src/ProducerAndConsumerTool.java
new file mode 100644
index 0000000..a1b96ff
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/ProducerAndConsumerTool.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+import javax.jms.MessageListener;
+
+/**
+ * A simple tool for producing and consuming messages
+ * 
+ * 
+ */
+public class ProducerAndConsumerTool extends ConsumerTool implements MessageListener {
+
+    public static void main(String[] args) {
+
+        ConsumerTool consumerTool = new ConsumerTool();
+        String[] unknown = CommandLineSupport.setOptions(consumerTool, args);
+        HashSet<String> set1 = new HashSet<String>(Arrays.asList(unknown));
+
+        ProducerTool producerTool = new ProducerTool();
+        unknown = CommandLineSupport.setOptions(producerTool, args);
+        HashSet<String> set2 = new HashSet<String>(Arrays.asList(unknown));
+
+        set1.retainAll(set2);
+        if (set1.size() > 0) {
+            System.out.println("Unknown options: " + set1);
+            System.exit(-1);
+        }
+
+        consumerTool.run();
+        producerTool.run();
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/ProducerTool.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/ProducerTool.java b/assembly/src/release/examples/openwire/swissarmy/src/ProducerTool.java
new file mode 100755
index 0000000..3693fd7
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/ProducerTool.java
@@ -0,0 +1,252 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.util.IndentPrinter;
+
+/**
+ * A simple tool for publishing messages
+ * 
+ * 
+ */
+public class ProducerTool extends Thread {
+
+    private Destination destination;
+    private int messageCount = 10;
+    private long sleepTime;
+    private boolean verbose = true;
+    private int messageSize = 255;
+    private static int parallelThreads = 1;
+    private long timeToLive;
+    private String user = ActiveMQConnection.DEFAULT_USER;
+    private String password = ActiveMQConnection.DEFAULT_PASSWORD;
+    private String url = ActiveMQConnection.DEFAULT_BROKER_URL;
+    private String subject = "TOOL.DEFAULT";
+    private boolean topic;
+    private boolean transacted;
+    private boolean persistent;
+    private long batch = 10;
+    private static Object lockResults = new Object();
+
+    public static void main(String[] args) {
+        ArrayList<ProducerTool> threads = new ArrayList();
+        ProducerTool producerTool = new ProducerTool();
+        String[] unknown = CommandLineSupport.setOptions(producerTool, args);
+        if (unknown.length > 0) {
+            System.out.println("Unknown options: " + Arrays.toString(unknown));
+            System.exit(-1);
+        }
+        producerTool.showParameters();
+        for (int threadCount = 1; threadCount <= parallelThreads; threadCount++) {
+            producerTool = new ProducerTool();
+            CommandLineSupport.setOptions(producerTool, args);
+            producerTool.start();
+            threads.add(producerTool);
+        }
+
+        while (true) {
+            Iterator<ProducerTool> itr = threads.iterator();
+            int running = 0;
+            while (itr.hasNext()) {
+                ProducerTool thread = itr.next();
+                if (thread.isAlive()) {
+                    running++;
+                }
+            }
+            if (running <= 0) {
+                System.out.println("All threads completed their work");
+                break;
+            }
+            try {
+                Thread.sleep(1000);
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    public void showParameters() {
+        System.out.println("Connecting to URL: " + url + " (" + user + ":" + password + ")");
+        System.out.println("Publishing a Message with size " + messageSize + " to " + (topic ? "topic" : "queue") + ": " + subject);
+        System.out.println("Using " + (persistent ? "persistent" : "non-persistent") + " messages");
+        System.out.println("Sleeping between publish " + sleepTime + " ms");
+        System.out.println("Running " + parallelThreads + " parallel threads");
+
+        if (timeToLive != 0) {
+            System.out.println("Messages time to live " + timeToLive + " ms");
+        }
+    }
+
+    public void run() {
+        Connection connection = null;
+        try {
+            // Create the connection.
+            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            // Create the session
+            Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+            if (topic) {
+                destination = session.createTopic(subject);
+            } else {
+                destination = session.createQueue(subject);
+            }
+
+            // Create the producer.
+            MessageProducer producer = session.createProducer(destination);
+            if (persistent) {
+                producer.setDeliveryMode(DeliveryMode.PERSISTENT);
+            } else {
+                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            }
+            if (timeToLive != 0) {
+                producer.setTimeToLive(timeToLive);
+            }
+
+            // Start sending messages
+            sendLoop(session, producer);
+
+            System.out.println("[" + this.getName() + "] Done.");
+
+            synchronized (lockResults) {
+                ActiveMQConnection c = (ActiveMQConnection) connection;
+                System.out.println("[" + this.getName() + "] Results:\n");
+                c.getConnectionStats().dump(new IndentPrinter());
+            }
+
+        } catch (Exception e) {
+            System.out.println("[" + this.getName() + "] Caught: " + e);
+            e.printStackTrace();
+        } finally {
+            try {
+                connection.close();
+            } catch (Throwable ignore) {
+            }
+        }
+    }
+
+    protected void sendLoop(Session session, MessageProducer producer) throws Exception {
+
+        for (int i = 0; i < messageCount || messageCount == 0; i++) {
+
+            TextMessage message = session.createTextMessage(createMessageText(i));
+
+            if (verbose) {
+                String msg = message.getText();
+                if (msg.length() > 50) {
+                    msg = msg.substring(0, 50) + "...";
+                }
+                System.out.println("[" + this.getName() + "] Sending message: '" + msg + "'");
+            }
+
+            producer.send(message);
+
+            if (transacted && (i % batch == 0)) {
+                System.out.println("[" + this.getName() + "] Committing " + messageCount + " messages");
+                session.commit();
+            }
+            Thread.sleep(sleepTime);
+        }
+    }
+
+    private String createMessageText(int index) {
+        StringBuffer buffer = new StringBuffer(messageSize);
+        buffer.append("Message: " + index + " sent at: " + new Date());
+        if (buffer.length() > messageSize) {
+            return buffer.substring(0, messageSize);
+        }
+        for (int i = buffer.length(); i < messageSize; i++) {
+            buffer.append(' ');
+        }
+        return buffer.toString();
+    }
+
+    public void setPersistent(boolean durable) {
+        this.persistent = durable;
+    }
+
+    public void setMessageCount(int messageCount) {
+        this.messageCount = messageCount;
+    }
+
+    public void setMessageSize(int messageSize) {
+        this.messageSize = messageSize;
+    }
+
+    public void setPassword(String pwd) {
+        this.password = pwd;
+    }
+
+    public void setSleepTime(long sleepTime) {
+        this.sleepTime = sleepTime;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public void setTimeToLive(long timeToLive) {
+        this.timeToLive = timeToLive;
+    }
+
+    public void setParallelThreads(int parallelThreads) {
+        if (parallelThreads < 1) {
+            parallelThreads = 1;
+        }
+        this.parallelThreads = parallelThreads;
+    }
+
+    public void setTopic(boolean topic) {
+        this.topic = topic;
+    }
+
+    public void setQueue(boolean queue) {
+        this.topic = !queue;
+    }
+
+    public void setTransacted(boolean transacted) {
+        this.transacted = transacted;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    public void setBatch(long batch) {
+        this.batch = batch;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/RequesterTool.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/RequesterTool.java b/assembly/src/release/examples/openwire/swissarmy/src/RequesterTool.java
new file mode 100644
index 0000000..cd1a650
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/RequesterTool.java
@@ -0,0 +1,257 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.util.Arrays;
+import java.util.Date;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.util.IndentPrinter;
+
+/**
+ * A simple tool for publishing messages
+ * 
+ * 
+ */
+public class RequesterTool {
+
+    private int messageCount = 10;
+    private long sleepTime;
+    private boolean verbose = true;
+    private int messageSize = 255;
+    private long timeToLive;
+    private String subject = "TOOL.DEFAULT";
+    private String replySubject;
+    private boolean topic;
+    private String user = ActiveMQConnection.DEFAULT_USER;
+    private String password = ActiveMQConnection.DEFAULT_PASSWORD;
+    private String url = ActiveMQConnection.DEFAULT_BROKER_URL;
+    private boolean transacted;
+    private boolean persistent;
+    private String clientId;
+
+    private Destination destination;
+    private Destination replyDest;
+    private MessageProducer producer;
+    private MessageConsumer consumer;
+    private Session session;
+
+    public static void main(String[] args) {
+        RequesterTool requesterTool = new RequesterTool();
+        String[] unknown = CommandLineSupport.setOptions(requesterTool, args);
+        if (unknown.length > 0) {
+            System.out.println("Unknown options: " + Arrays.toString(unknown));
+            System.exit(-1);
+        }
+        requesterTool.run();
+    }
+
+    public void run() {
+
+        Connection connection = null;
+        try {
+
+            System.out.println("Connecting to URL: " + url);
+            System.out.println("Publishing a Message with size " + messageSize + " to " + (topic ? "topic" : "queue") + ": " + subject);
+            System.out.println("Using " + (persistent ? "persistent" : "non-persistent") + " messages");
+            System.out.println("Sleeping between publish " + sleepTime + " ms");
+
+            // Create the connection
+            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
+            connection = connectionFactory.createConnection();
+            if (persistent && clientId != null && clientId.length() > 0 && !"null".equals(clientId)) {
+                connection.setClientID(clientId);
+            }
+            connection.start();
+
+            // Create the Session
+            session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
+
+            // And the Destinations..
+            if (topic) {
+                destination = session.createTopic(subject);
+                if (replySubject == null || replySubject.equals("")) {
+                    replyDest = session.createTemporaryTopic();
+                } else {
+                    replyDest = session.createTopic(replySubject);
+                }
+            } else {
+                destination = session.createQueue(subject);
+                if (replySubject == null || replySubject.equals("")) {
+                    replyDest = session.createTemporaryQueue();
+                } else {
+                    replyDest = session.createQueue(replySubject);
+                }
+            }
+            System.out.println("Reply Destination: " + replyDest);
+
+            // Create the producer
+            producer = session.createProducer(destination);
+            if (persistent) {
+                producer.setDeliveryMode(DeliveryMode.PERSISTENT);
+            } else {
+                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            }
+            if (timeToLive != 0) {
+                System.out.println("Messages time to live " + timeToLive + " ms");
+                producer.setTimeToLive(timeToLive);
+            }
+
+            // Create the reply consumer
+            consumer = session.createConsumer(replyDest);
+
+            // Start sending reqests.
+            requestLoop();
+
+            System.out.println("Done.");
+
+            // Use the ActiveMQConnection interface to dump the connection
+            // stats.
+            ActiveMQConnection c = (ActiveMQConnection)connection;
+            c.getConnectionStats().dump(new IndentPrinter());
+
+        } catch (Exception e) {
+            System.out.println("Caught: " + e);
+            e.printStackTrace();
+        } finally {
+            try {
+                connection.close();
+            } catch (Throwable ignore) {
+            }
+        }
+    }
+
+    protected void requestLoop() throws Exception {
+
+        for (int i = 0; i < messageCount || messageCount == 0; i++) {
+
+            TextMessage message = session.createTextMessage(createMessageText(i));
+            message.setJMSReplyTo(replyDest);
+
+            if (verbose) {
+                String msg = message.getText();
+                if (msg.length() > 50) {
+                    msg = msg.substring(0, 50) + "...";
+                }
+                System.out.println("Sending message: " + msg);
+            }
+
+            producer.send(message);
+            if (transacted) {
+                session.commit();
+            }
+
+            System.out.println("Waiting for reponse message...");
+            Message message2 = consumer.receive();
+            if (message2 instanceof TextMessage) {
+                System.out.println("Reponse message: " + ((TextMessage)message2).getText());
+            } else {
+                System.out.println("Reponse message: " + message2);
+            }
+            if (transacted) {
+                session.commit();
+            }
+
+            Thread.sleep(sleepTime);
+
+        }
+    }
+
+    /**
+     * @param i
+     * @return
+     */
+    private String createMessageText(int index) {
+        StringBuffer buffer = new StringBuffer(messageSize);
+        buffer.append("Message: " + index + " sent at: " + new Date());
+        if (buffer.length() > messageSize) {
+            return buffer.substring(0, messageSize);
+        }
+        for (int i = buffer.length(); i < messageSize; i++) {
+            buffer.append(' ');
+        }
+        return buffer.toString();
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public void setPersistent(boolean durable) {
+        this.persistent = durable;
+    }
+
+    public void setMessageCount(int messageCount) {
+        this.messageCount = messageCount;
+    }
+
+    public void setMessageSize(int messageSize) {
+        this.messageSize = messageSize;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setSleepTime(long sleepTime) {
+        this.sleepTime = sleepTime;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public void setTimeToLive(long timeToLive) {
+        this.timeToLive = timeToLive;
+    }
+
+    public void setTopic(boolean topic) {
+        this.topic = topic;
+    }
+
+    public void setQueue(boolean queue) {
+        this.topic = !queue;
+    }
+
+    public void setTransacted(boolean transacted) {
+        this.transacted = transacted;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    public void setReplySubject(String replySubject) {
+        this.replySubject = replySubject;
+    }
+}


Mime
View raw message