activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject [11/18] Porting apollo examples structure to ActiveMQ 5.9.
Date Thu, 10 Oct 2013 14:40:34 GMT
http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/readme.md
new file mode 100644
index 0000000..fe842f3
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/readme.md
@@ -0,0 +1,38 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example demonstrates how to use composite destinations for both sending and receiving.
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    mvn -P consumer
+
+In another terminal window run:
+
+    mvn -P producer
+
+## What to look for
+In the console of the producer, you should see log messages indicating messages have been successfully sent
+to the broker.
+
+In the console of the consumer, you should see log messages indicating messages have been received on each individual
+destination:
+
+* test-queue
+* test-queue-foo
+* test-queue-bar
+* test-topic-foo

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Consumer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Consumer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Consumer.java
new file mode 100644
index 0000000..cedffb2
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Consumer.java
@@ -0,0 +1,121 @@
+/**
+ * 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.composite.dest;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Consumer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long TIMEOUT = 20000;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... will timeout after " + TIMEOUT / 1000 +"s");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            Destination destinationFoo = session.createQueue("test-queue-foo");
+            Destination destinationBar = session.createQueue("test-queue-bar");
+            Destination destinationTopicFoo = session.createTopic("test-topic-foo");
+
+            MessageConsumer consumer = session.createConsumer(destination);
+            MessageConsumer consumerFoo = session.createConsumer(destinationFoo);
+            MessageConsumer consumerBar = session.createConsumer(destinationBar);
+            MessageConsumer consumerTopicFoo = session.createConsumer(destinationTopicFoo);
+
+            int i = 0;
+            while (true) {
+                Message message = consumer.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message on test-queue: " + text);
+                    }
+                } else {
+                    break;
+                }
+
+                message = consumerFoo.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message on test-queue-foo: " + text);
+                    }
+                } else {
+                    break;
+                }
+
+                message = consumerBar.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message on test-queue-bar: " + text);
+                    }
+                } else {
+                    break;
+                }
+
+                message = consumerTopicFoo.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message on test-topic-bar: " + text);
+                    }
+                } else {
+                    break;
+                }
+
+            }
+
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Producer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Producer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Producer.java
new file mode 100644
index 0000000..24ba652
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-composite-destinations/src/main/java/example/composite/dest/Producer.java
@@ -0,0 +1,73 @@
+/**
+ * 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.composite.dest;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Producer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue,test-queue-foo,test-queue-bar,topic://test-topic-foo");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        } finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/pom.xml
new file mode 100644
index 0000000..75dada5
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>jms-example-durable-sub</artifactId>
+    <profiles>
+        <profile>
+            <id>subscriber</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.topic.durable.Subscriber</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>publisher</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.topic.durable.Publisher</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/readme.md
new file mode 100644
index 0000000..1013ba5
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/readme.md
@@ -0,0 +1,29 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example does basic publish-subscribe messaging using Topics
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    mvn -Psubscriber -DclientId=<client_id_goes_here>
+
+In another terminal window run:
+
+    mvn -Ppublisher
+
+You can kill the subscriber at any point and it will not miss messages because the subscription it creates
+is durable

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Publisher.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Publisher.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Publisher.java
new file mode 100644
index 0000000..69f8115
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Publisher.java
@@ -0,0 +1,76 @@
+/**
+ * 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.topic.durable;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Publisher {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createTopic("test-topic");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            // tell the subscribers we're done
+            producer.send(session.createTextMessage("END"));
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Subscriber.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Subscriber.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Subscriber.java
new file mode 100644
index 0000000..918bd87
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-durable-sub/src/main/java/example/topic/durable/Subscriber.java
@@ -0,0 +1,97 @@
+/**
+ * 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.topic.durable;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Subscriber implements MessageListener {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+
+    private static final Boolean NON_TRANSACTED = false;
+
+
+    private final CountDownLatch countDownLatch;
+    public Subscriber(CountDownLatch latch) {
+        countDownLatch = latch;
+    }
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... Either waiting for END message or press Ctrl+C to exit");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            String clientId = System.getProperty("clientId");
+            connection.setClientID(clientId);
+
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Topic destination = session.createTopic("test-topic");
+
+            MessageConsumer consumer = session.createDurableSubscriber(destination, clientId) ;
+            consumer.setMessageListener(new Subscriber(latch));
+
+            latch.await();
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+    @Override
+    public void onMessage(Message message) {
+        try {
+            if (message instanceof TextMessage) {
+                String text = ((TextMessage) message).getText();
+                if ("END".equalsIgnoreCase(text)) {
+                    System.out.println("Received END message!");
+                    countDownLatch.countDown();
+                }
+                else {
+                    System.out.println("Received message:" +text);
+                }
+            }
+        } catch (JMSException e) {
+            System.out.println("Got a JMS Exception!");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/pom.xml
new file mode 100644
index 0000000..8e1daed
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jms-example-exclusive-consumer</artifactId>
+    <profiles>
+        <profile>
+            <id>consumer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.exclusive.Consumer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>producer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.exclusive.Producer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/readme.md
new file mode 100644
index 0000000..49bfaf5
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/readme.md
@@ -0,0 +1,30 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example demos using exclusive consumers (one single consumer)
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+You will want to run **multiple** instances of a consumer. To run the consumer open a
+terminal and type
+
+    mvn -Pconsumer
+
+In another terminal window run:
+
+    mvn -Pproducer
+
+You'll notice that even though you have multiple consumers, only one consumer will be consuming messages. If you
+kill the consumer that's currently receiving messages, one of the other consumers will pick up the consumption.

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Consumer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Consumer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Consumer.java
new file mode 100644
index 0000000..2b46cfe
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Consumer.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.queue.exclusive;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Consumer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long TIMEOUT = 20000;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... will timeout after " + TIMEOUT / 1000 +"s");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Queue destination = session.createQueue("test-queue?consumer.exclusive=true");
+            MessageConsumer consumer = session.createConsumer(destination);
+
+            int i = 0;
+            while (true) {
+                Message message = consumer.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message: " + text);
+                    }
+                } else {
+                    break;
+                }
+            }
+
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Producer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Producer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Producer.java
new file mode 100644
index 0000000..18abb75
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-exclusive-consumer/src/main/java/example/queue/exclusive/Producer.java
@@ -0,0 +1,73 @@
+/**
+ * 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.queue.exclusive;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Producer {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/pom.xml
new file mode 100644
index 0000000..fec0ac4
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jms-example-message-browser</artifactId>
+
+    <profiles>
+        <profile>
+            <id>browser</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.browser.Browser</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>producer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.browser.Producer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/readme.md
new file mode 100644
index 0000000..fcdbc3d
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/readme.md
@@ -0,0 +1,28 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example demos how to browse a queue without consuming from it
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+Run these steps in order:
+
+1. In one terminal window run:
+
+    mvn -Pproducer
+
+2. In another terminal window run:
+
+    mvn -Pbrowser
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Browser.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Browser.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Browser.java
new file mode 100644
index 0000000..d6b2555
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Browser.java
@@ -0,0 +1,72 @@
+/**
+ * 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.browser;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+import java.util.Enumeration;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Browser {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Queue destination = session.createQueue("test-queue");
+            QueueBrowser browser = session.createBrowser(destination);
+            Enumeration enumeration = browser.getEnumeration();
+
+            while (enumeration.hasMoreElements()) {
+                TextMessage message = (TextMessage) enumeration.nextElement();
+                System.out.println("Browsing: " + message);
+                TimeUnit.MILLISECONDS.sleep(DELAY);
+            }
+
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Producer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Producer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Producer.java
new file mode 100644
index 0000000..3b26136
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-message-browser/src/main/java/example/browser/Producer.java
@@ -0,0 +1,74 @@
+/**
+ * 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.browser;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Producer {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/pom.xml
new file mode 100644
index 0000000..c944734
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>jms-example-queue-selector</artifactId>
+    <profiles>
+        <profile>
+            <id>consumer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.selector.Consumer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>producer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.selector.Producer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/readme.md
new file mode 100644
index 0000000..d05fb2b
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/readme.md
@@ -0,0 +1,29 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example shows how to use selectors to filter out messages based on criteria
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    mvn -Pconsumer
+
+In another terminal window run:
+
+    mvn -Pproducer
+
+In the consumer's terminal, you'll notice that not all of the messages that the producer sent were consumed.
+Only those that had the property "intended" equal to "me"

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Consumer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Consumer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Consumer.java
new file mode 100644
index 0000000..59a8851
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Consumer.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.queue.selector;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Consumer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long TIMEOUT = 20000;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... will timeout after " + TIMEOUT / 1000 +"s");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageConsumer consumer = session.createConsumer(destination, "intended = 'me'");
+
+            int i = 0;
+            while (true) {
+                Message message = consumer.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message: " + text);
+                    }
+                } else {
+                    break;
+                }
+            }
+
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Producer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Producer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Producer.java
new file mode 100644
index 0000000..328d7ec
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue-selector/src/main/java/example/queue/selector/Producer.java
@@ -0,0 +1,81 @@
+/**
+ * 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.queue.selector;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Producer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                if (i % 2 == 0) {
+                    System.out.println("Sending to me");
+                    message.setStringProperty("intended", "me");
+                } else {
+                    System.out.println("Sending to you");
+                    message.setStringProperty("intended", "you");
+                }
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/pom.xml
new file mode 100644
index 0000000..ed2b3ac
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jms-example-queue</artifactId>
+    <profiles>
+        <profile>
+            <id>consumer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.Consumer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>producer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.queue.Producer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/readme.md
new file mode 100644
index 0000000..6e0c613
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/readme.md
@@ -0,0 +1,26 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example does basic point-to-point messaging using Queues
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    mvn -Pconsumer
+
+In another terminal window run:
+
+    mvn -Pproducer

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Consumer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Consumer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Consumer.java
new file mode 100644
index 0000000..fe5abfa
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Consumer.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.queue;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Consumer {
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long TIMEOUT = 20000;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... will timeout after " + TIMEOUT / 1000 +"s");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageConsumer consumer = session.createConsumer(destination);
+
+            int i = 0;
+            while (true) {
+                Message message = consumer.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message: " + text);
+                    }
+                } else {
+                    break;
+                }
+            }
+
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Producer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Producer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Producer.java
new file mode 100644
index 0000000..664c1b3
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/java/example/queue/Producer.java
@@ -0,0 +1,74 @@
+/**
+ * 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.queue;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Producer {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageProducer producer = session.createProducer(destination);
+
+            for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) {
+                TextMessage message = session.createTextMessage("Message #" + i);
+                System.out.println("Sending message #" + i);
+                producer.send(message);
+                Thread.sleep(DELAY);
+            }
+
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/resources/log4j.properties b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/resources/log4j.properties
new file mode 100644
index 0000000..211f9d4
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-queue/src/main/resources/log4j.properties
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# Setup the default logging levels
+#
+log4j.rootLogger=INFO, console
+
+#
+# Uncomment one of the following to enable trace logging
+#
+#log4j.logger.org.apache.activemq=TRACE
+
+# Console Settings
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%C %-5p | %m%n
+log4j.appender.console.threshold=TRACE

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/pom.xml b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/pom.xml
new file mode 100644
index 0000000..c9892e4
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>advanced-openwire-example</artifactId>
+        <groupId>example</groupId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>jms-example-temp-destinations</artifactId>
+    <profiles>
+        <profile>
+            <id>consumer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.tempdest.Consumer</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>producer</id>
+            <build>
+                <defaultGoal>package</defaultGoal>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>example.tempdest.ProducerRequestReply</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/readme.md b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/readme.md
new file mode 100644
index 0000000..cdf0076
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/readme.md
@@ -0,0 +1,28 @@
+## Overview
+
+This is an example of how to use the ActiveMQ 5.x / OpenWire protocol to communicate with ActiveMQ
+
+This example shows how to do request response with temporary destinations
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    mvn -Pconsumer
+
+In another terminal window run:
+
+    mvn -Pproducer
+
+You'll notice that the producer received a reply for the request it sent.

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/Consumer.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/Consumer.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/Consumer.java
new file mode 100644
index 0000000..d3f0a42
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/Consumer.java
@@ -0,0 +1,83 @@
+package example.tempdest; /**
+ * 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.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class Consumer {
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final long TIMEOUT = 20000;
+
+    public static void main(String[] args) {
+
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        System.out.println("\nWaiting to receive messages... will timeout after " + TIMEOUT / 1000 +"s");
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            final Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageConsumer consumer = session.createConsumer(destination);
+
+            int i = 0;
+            while (true) {
+                Message message = consumer.receive(TIMEOUT);
+
+                if (message != null) {
+                    if (message instanceof TextMessage) {
+                        String text = ((TextMessage) message).getText();
+                        System.out.println("Got " + i++ + ". message: " + text);
+                        Destination replyTo = message.getJMSReplyTo();
+                        MessageProducer producer = session.createProducer(replyTo);
+                        producer.send(session.createTextMessage("You made it to the consumer, here is your response"));
+                        producer.close();
+                    }
+                } else {
+                    break;
+                }
+            }
+
+            consumer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/ProducerRequestReply.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/ProducerRequestReply.java b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/ProducerRequestReply.java
new file mode 100644
index 0000000..34b63d0
--- /dev/null
+++ b/assembly/src/release/examples/openwire/advanced-scenarios/jms-example-temp-destinations/src/main/java/example/tempdest/ProducerRequestReply.java
@@ -0,0 +1,85 @@
+package example.tempdest; /**
+ * 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.ActiveMQConnectionFactory;
+
+import javax.jms.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class ProducerRequestReply{
+
+    private static final String BROKER_URL = "tcp://localhost:61616";
+    private static final Boolean NON_TRANSACTED = false;
+    private static final int NUM_MESSAGES_TO_SEND = 100;
+    private static final long DELAY = 100;
+
+    public static void main(String[] args) {
+        String url = BROKER_URL;
+        if (args.length > 0) {
+            url = args[0].trim();
+        }
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url);
+        Connection connection = null;
+
+        try {
+
+            connection = connectionFactory.createConnection();
+            connection.start();
+
+            Session session = connection.createSession(NON_TRANSACTED, Session.AUTO_ACKNOWLEDGE);
+            Destination destination = session.createQueue("test-queue");
+            MessageProducer producer = session.createProducer(destination);
+            Destination replyDest = session.createTemporaryQueue();
+
+            // set up the consumer to handle the reply
+            MessageConsumer replyConsumer = session.createConsumer(replyDest);
+            replyConsumer.setMessageListener(new MessageListener() {
+                @Override
+                public void onMessage(Message message) {
+                    System.out.println("*** REPLY *** ");
+                    System.out.println(message.toString());
+                }
+            });
+
+            TextMessage message = session.createTextMessage("I need a response for this, please");
+            message.setJMSReplyTo(replyDest);
+
+            producer.send(message);
+
+            // wait for a response
+            TimeUnit.SECONDS.sleep(2);
+            producer.close();
+            session.close();
+
+        } catch (Exception e) {
+            System.out.println("Caught exception!");
+        }
+        finally {
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (JMSException e) {
+                    System.out.println("Could not close an open connection...");
+                }
+            }
+        }
+    }
+
+}


Mime
View raw message