You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/12 05:47:35 UTC

[41/52] [abbrv] [partial] activemq-artemis git commit: This commit has improvements on the examples including:

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java b/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
new file mode 100644
index 0000000..e014693
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java
@@ -0,0 +1,212 @@
+/*
+ * 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 org.apache.activemq.artemis.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+
+/**
+ * This examples demonstrates the use of ActiveMQ Artemis "Diverts" to transparently divert or copy messages
+ * from one address to another.
+ *
+ * Please see the readme.html for more information.
+ */
+public class DivertExample {
+
+   public static void main(final String[] args) throws Exception {
+      Connection connectionLondon = null;
+
+      Connection connectionNewYork = null;
+      try {
+         // Step 2. Look-up the queue orderQueue on the London server - this is the queue any orders are sent to
+         Queue orderQueue = ActiveMQJMSClient.createQueue("orders");
+
+         // Step 3. Look-up the topic priceUpdates on the London server- this is the topic that any price updates are
+         // sent to
+         Topic priceUpdates = ActiveMQJMSClient.createTopic("priceUpdates");
+
+         // Step 4. Look-up the spy topic on the London server- this is what we will use to snoop on any orders
+         Topic spyTopic = ActiveMQJMSClient.createTopic("spyTopic");
+
+         // Step 7. Look-up the topic newYorkPriceUpdates on the New York server - any price updates sent to
+         // priceUpdates on the London server will
+         // be diverted to the queue priceForward on the London server, and a bridge will consume from that queue and
+         // forward
+         // them to the address newYorkPriceUpdates on the New York server where they will be distributed to the topic
+         // subscribers on
+         // the New York server
+         Topic newYorkPriceUpdates = ActiveMQJMSClient.createTopic("newYorkPriceUpdates");
+
+         // Step 8. Perform a lookup on the Connection Factory on the London server
+         ConnectionFactory cfLondon = new ActiveMQConnectionFactory("tcp://localhost:61616");
+
+         // Step 9. Perform a lookup on the Connection Factory on the New York server
+         ConnectionFactory cfNewYork = new ActiveMQConnectionFactory("tcp://localhost:61617");
+
+         // Step 10. Create a JMS Connection on the London server
+         connectionLondon = cfLondon.createConnection();
+
+         // Step 11. Create a JMS Connection on the New York server
+         connectionNewYork = cfNewYork.createConnection();
+
+         // Step 12. Create a JMS Session on the London server
+         Session sessionLondon = connectionLondon.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         // Step 13. Create a JMS Session on the New York server
+         Session sessionNewYork = connectionNewYork.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         // Step 14. Create a JMS MessageProducer orderProducer that sends to the queue orderQueue on the London server
+         MessageProducer orderProducer = sessionLondon.createProducer(orderQueue);
+
+         // Step 15. Create a JMS MessageProducer priceProducer that sends to the topic priceUpdates on the London
+         // server
+         MessageProducer priceProducer = sessionLondon.createProducer(priceUpdates);
+
+         // Step 15. Create a JMS subscriber which subscribes to the spyTopic on the London server
+         MessageConsumer spySubscriberA = sessionLondon.createConsumer(spyTopic);
+
+         // Step 16. Create another JMS subscriber which also subscribes to the spyTopic on the London server
+         MessageConsumer spySubscriberB = sessionLondon.createConsumer(spyTopic);
+
+         // Step 17. Create a JMS MessageConsumer which consumes orders from the order queue on the London server
+         MessageConsumer orderConsumer = sessionLondon.createConsumer(orderQueue);
+
+         // Step 18. Create a JMS subscriber which subscribes to the priceUpdates topic on the London server
+         MessageConsumer priceUpdatesSubscriberLondon = sessionLondon.createConsumer(priceUpdates);
+
+         // Step 19. Create a JMS subscriber which subscribes to the newYorkPriceUpdates topic on the New York server
+         MessageConsumer newYorkPriceUpdatesSubscriberA = sessionNewYork.createConsumer(newYorkPriceUpdates);
+
+         // Step 20. Create another JMS subscriber which also subscribes to the newYorkPriceUpdates topic on the New
+         // York server
+         MessageConsumer newYorkPriceUpdatesSubscriberB = sessionNewYork.createConsumer(newYorkPriceUpdates);
+
+         // Step 21. Start the connections
+
+         connectionLondon.start();
+
+         connectionNewYork.start();
+
+         // Step 22. Create an order message
+         TextMessage orderMessage = sessionLondon.createTextMessage("This is an order");
+
+         // Step 23. Send the order message to the order queue on the London server
+         orderProducer.send(orderMessage);
+
+         System.out.println("Sent message: " + orderMessage.getText());
+
+         // Step 24. The order message is consumed by the orderConsumer on the London server
+         TextMessage receivedOrder = (TextMessage) orderConsumer.receive(5000);
+
+         System.out.println("Received order: " + receivedOrder.getText());
+
+         // Step 25. A copy of the order is also received by the spyTopic subscribers on the London server
+         TextMessage spiedOrder1 = (TextMessage) spySubscriberA.receive(5000);
+
+         System.out.println("Snooped on order: " + spiedOrder1.getText());
+
+         TextMessage spiedOrder2 = (TextMessage) spySubscriberB.receive(5000);
+
+         System.out.println("Snooped on order: " + spiedOrder2.getText());
+
+         // Step 26. Create and send a price update message, destined for London
+         TextMessage priceUpdateMessageLondon = sessionLondon.createTextMessage("This is a price update for London");
+
+         priceUpdateMessageLondon.setStringProperty("office", "London");
+
+         priceProducer.send(priceUpdateMessageLondon);
+
+         // Step 27. The price update *should* be received by the local subscriber since we only divert messages
+         // where office = New York
+         TextMessage receivedUpdate = (TextMessage) priceUpdatesSubscriberLondon.receive(2000);
+
+         System.out.println("Received price update locally: " + receivedUpdate.getText());
+
+         // Step 28. The price update *should not* be received in New York
+
+         TextMessage priceUpdate1 = (TextMessage) newYorkPriceUpdatesSubscriberA.receive(1000);
+
+         if (priceUpdate1 != null) {
+            throw new IllegalStateException("Message is not null");
+         }
+
+         System.out.println("Did not received price update in New York, look it's: " + priceUpdate1);
+
+         TextMessage priceUpdate2 = (TextMessage) newYorkPriceUpdatesSubscriberB.receive(1000);
+
+         if (priceUpdate2 != null) {
+            throw new IllegalStateException("Message is not null");
+         }
+
+         System.out.println("Did not received price update in New York, look it's: " + priceUpdate2);
+
+         // Step 29. Create a price update message, destined for New York
+
+         TextMessage priceUpdateMessageNewYork = sessionLondon.createTextMessage("This is a price update for New York");
+
+         priceUpdateMessageNewYork.setStringProperty("office", "New York");
+
+         // Step 30. Send the price update message to the priceUpdates topic on the London server
+         priceProducer.send(priceUpdateMessageNewYork);
+
+         // Step 31. The price update *should not* be received by the local subscriber to the priceUpdates topic
+         // since it has been *exclusively* diverted to the priceForward queue, because it has a header saying
+         // it is destined for the New York office
+         Message message = priceUpdatesSubscriberLondon.receive(1000);
+
+         if (message != null) {
+            throw new IllegalStateException("Message is not null");
+         }
+
+         System.out.println("Didn't receive local price update, look, it's: " + message);
+
+         // Step 32. The remote subscribers on server 1 *should* receive a copy of the price update since
+         // it has been diverted to a local priceForward queue which has a bridge consuming from it and which
+         // forwards it to the same address on server 1.
+         // We notice how the forwarded messages have had a special header added by our custom transformer that
+         // we told the divert to use
+
+         priceUpdate1 = (TextMessage) newYorkPriceUpdatesSubscriberA.receive(5000);
+
+         System.out.println("Received forwarded price update on server 1: " + priceUpdate1.getText());
+         System.out.println("Time of forward: " + priceUpdate1.getLongProperty("time_of_forward"));
+
+         priceUpdate2 = (TextMessage) newYorkPriceUpdatesSubscriberB.receive(5000);
+
+         System.out.println("Received forwarded price update on server 2: " + priceUpdate2.getText());
+         System.out.println("Time of forward: " + priceUpdate2.getLongProperty("time_of_forward"));
+      }
+      finally {
+         if (connectionLondon != null) {
+            connectionLondon.close();
+         }
+         if (connectionNewYork != null) {
+            connectionNewYork.close();
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml
new file mode 100644
index 0000000..7ce362a
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml
@@ -0,0 +1,121 @@
+<?xml version='1.0'?>
+<!--
+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.
+-->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xmlns="urn:activemq"
+               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+   <jms xmlns="urn:activemq:jms">
+      <!-- Destinations used by the example -->
+
+      <!-- The order queue -->
+      <queue name="orders"/>
+
+      <!-- The queue that prices are forwarded to before being bridged to the New York server -->
+      <queue name="priceForwarding"/>
+
+      <!-- The topic for price updates -->
+      <topic name="priceUpdates"/>
+
+      <!-- The spy topic for snooping on orders -->
+      <topic name="spyTopic"/>
+   </jms>
+
+   <core xmlns="urn:activemq:core">
+
+      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
+
+      <journal-directory>${data.dir:../data}/journal</journal-directory>
+
+      <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
+
+      <paging-directory>${data.dir:../data}/paging</paging-directory>
+
+      <!-- Connectors -->
+
+      <connectors>
+         <!-- This connector corresponds to the New York server -->
+         <connector name="newyork-connector">tcp://localhost:61617</connector>
+      </connectors>
+
+      <!-- Acceptors -->
+
+      <acceptors>
+         <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
+      </acceptors>
+
+      <!-- Divert configuration -->
+
+      <!-- We need to create a core queue for the JMS queue explicitly because the bridge will be deployed
+      before the JMS queue is deployed, so the first time, it otherwise won't find the queue -->
+      <queues>
+         <queue name="jms.queue.priceForwarding">
+            <address>jms.queue.priceForwarding</address>
+         </queue>
+      </queues>
+
+      <diverts>
+         <divert name="order-divert">
+            <routing-name>order-divert</routing-name>
+            <address>jms.queue.orders</address>
+            <forwarding-address>jms.topic.spyTopic</forwarding-address>
+            <exclusive>false</exclusive>
+         </divert>
+
+         <divert name="prices-divert">
+            <routing-name>prices-divert</routing-name>
+            <address>jms.topic.priceUpdates</address>
+            <forwarding-address>jms.queue.priceForwarding</forwarding-address>
+            <filter string="office='New York'"/>
+            <transformer-class-name>org.apache.activemq.artemis.jms.example.AddForwardingTimeTransformer
+            </transformer-class-name>
+            <exclusive>true</exclusive>
+         </divert>
+      </diverts>
+
+      <!-- Bridge configuration -->
+
+      <bridges>
+         <bridge name="price-forward-bridge">
+            <queue-name>jms.queue.priceForwarding</queue-name>
+            <forwarding-address>jms.topic.newYorkPriceUpdates</forwarding-address>
+            <reconnect-attempts>-1</reconnect-attempts>
+            <static-connectors>
+               <connector-ref>newyork-connector</connector-ref>
+            </static-connectors>
+         </bridge>
+      </bridges>
+
+      <!-- Other config -->
+
+      <security-settings>
+         <!--security for example -->
+         <security-setting match="jms.#">
+            <permission type="createDurableQueue" roles="guest"/>
+            <permission type="deleteDurableQueue" roles="guest"/>
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="send" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml
new file mode 100644
index 0000000..315d13b
--- /dev/null
+++ b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml
@@ -0,0 +1,64 @@
+<?xml version='1.0'?>
+<!--
+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.
+-->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xmlns="urn:activemq"
+               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+   <jms xmlns="urn:activemq:jms">
+      <!-- Destinations used by the example -->
+
+      <!-- The topic for New York price updates -->
+
+      <topic name="newYorkPriceUpdates"/>
+   </jms>
+
+   <core xmlns="urn:activemq:core">
+
+      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
+
+      <journal-directory>${data.dir:../data}/journal</journal-directory>
+
+      <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
+
+      <paging-directory>${data.dir:../data}/paging</paging-directory>
+
+      <!-- Acceptors -->
+
+      <acceptors>
+         <acceptor name="netty-acceptor">tcp://localhost:61617</acceptor>
+      </acceptors>
+
+      <!-- Other config -->
+
+      <security-settings>
+         <!--security for example queue-->
+         <security-setting match="jms.#">
+            <permission type="createDurableQueue" roles="guest"/>
+            <permission type="deleteDurableQueue" roles="guest"/>
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="send" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/pom.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/pom.xml b/examples/broker-features/standard/durable-subscription/pom.xml
new file mode 100644
index 0000000..a502fff
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/pom.xml
@@ -0,0 +1,110 @@
+<?xml version='1.0'?>
+<!--
+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>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>1.0.1-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>durable-subscription</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Durable Subscription Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <configuration>${basedir}/target/classes/activemq/server0</configuration>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.DurableSubscriptionExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>durable-subscription</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/readme.html
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/readme.html b/examples/broker-features/standard/durable-subscription/readme.html
new file mode 100644
index 0000000..61b591f
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/readme.html
@@ -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.
+-->
+
+<html>
+  <head>
+    <title>ActiveMQ Artemis JMS Durable Subscription Example</title>
+    <link rel="stylesheet" type="text/css" href="../../../common/common.css" />
+    <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
+    <script type="text/javascript" src="../../../common/prettify.js"></script>
+  </head>
+  <body onload="prettyPrint()">
+     <h1>JMS Durable Subscription Example</h1>
+
+     <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
+     <p>This example demonstrates how to use a durable subscription with ActiveMQ Artemis.</p>
+     <p>Durable subscriptions are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p>
+     <p>Unlike non durable subscriptions, the key function of durable subscriptions is that the messages contained in them
+         persist longer than the lifetime of the subscriber - i.e. they will accumulate messages sent to the topic even
+         if the subscriber is not currently connected. They will also survive server restarts. Note that for the messages to
+         be persisted, the messages sent to them must be marked as persistent messages.</p>
+
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java b/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
new file mode 100644
index 0000000..46cd94c
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java
@@ -0,0 +1,116 @@
+/*
+ * 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 org.apache.activemq.artemis.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+import javax.naming.InitialContext;
+
+/**
+ * A simple JMS example that shows how to use a durable subscription.
+ */
+public class DurableSubscriptionExample {
+
+   public static void main(final String[] args) throws Exception {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try {
+         // Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         // Step 2. Look-up the JMS topic
+         Topic topic = (Topic) initialContext.lookup("topic/exampleTopic");
+
+         // Step 3. Look-up the JMS connection factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
+
+         // Step 4. Create a JMS connection
+         connection = cf.createConnection();
+
+         // Step 5. Set the client-id on the connection
+         connection.setClientID("durable-client");
+
+         // Step 6. Start the connection
+         connection.start();
+
+         // Step 7. Create a JMS session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         // Step 8. Create a JMS message producer
+         MessageProducer messageProducer = session.createProducer(topic);
+
+         // Step 9. Create the subscription and the subscriber.
+         TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subscriber-1");
+
+         // Step 10. Create a text message
+         TextMessage message1 = session.createTextMessage("This is a text message 1");
+
+         // Step 11. Send the text message to the topic
+         messageProducer.send(message1);
+
+         System.out.println("Sent message: " + message1.getText());
+
+         // Step 12. Consume the message from the durable subscription
+
+         TextMessage messageReceived = (TextMessage) subscriber.receive();
+
+         System.out.println("Received message: " + messageReceived.getText());
+
+         // Step 13. Create and send another message
+
+         TextMessage message2 = session.createTextMessage("This is a text message 2");
+
+         messageProducer.send(message2);
+
+         System.out.println("Sent message: " + message2.getText());
+
+         // Step 14. Close the subscriber - the server could even be stopped at this point!
+         subscriber.close();
+
+         // Step 15. Create a new subscriber on the *same* durable subscription.
+
+         subscriber = session.createDurableSubscriber(topic, "subscriber-1");
+
+         // Step 16. Consume the message
+
+         messageReceived = (TextMessage) subscriber.receive();
+
+         System.out.println("Received message: " + messageReceived.getText());
+
+         // Step 17. Close the subscriber
+         subscriber.close();
+
+         // Step 18. Delete the durable subscription
+         session.unsubscribe("subscriber-1");
+      }
+      finally {
+         if (connection != null) {
+            // Step 19. Be sure to close our JMS resources!
+            connection.close();
+         }
+         if (initialContext != null) {
+            // Step 20. Also close the initialContext!
+            initialContext.close();
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml
new file mode 100644
index 0000000..2b2ba2e
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/broker.xml
@@ -0,0 +1,61 @@
+<?xml version='1.0'?>
+<!--
+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.
+-->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xmlns="urn:activemq"
+               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+   <jms xmlns="urn:activemq:jms">
+      <!--the topic used by the example-->
+      <topic name="exampleTopic"/>
+   </jms>
+
+   <core xmlns="urn:activemq:core">
+
+      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
+
+      <journal-directory>${data.dir:../data}/journal</journal-directory>
+
+      <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
+
+      <paging-directory>${data.dir:../data}/paging</paging-directory>
+
+      <!-- Acceptors -->
+
+      <acceptors>
+         <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
+      </acceptors>
+
+      <!-- Other config -->
+
+      <security-settings>
+         <!--security for example topic-->
+         <security-setting match="jms.topic.exampleTopic">
+            <permission type="createDurableQueue" roles="guest"/>
+            <permission type="deleteDurableQueue" roles="guest"/>
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="send" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties
new file mode 100644
index 0000000..54bed6d
--- /dev/null
+++ b/examples/broker-features/standard/durable-subscription/src/main/resources/jndi.properties
@@ -0,0 +1,20 @@
+# 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.
+
+java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
+connectionFactory.ConnectionFactory=tcp://localhost:61616
+topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded-simple/pom.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded-simple/pom.xml b/examples/broker-features/standard/embedded-simple/pom.xml
new file mode 100644
index 0000000..8ffd616
--- /dev/null
+++ b/examples/broker-features/standard/embedded-simple/pom.xml
@@ -0,0 +1,84 @@
+<?xml version='1.0'?>
+<!--
+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>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>1.0.1-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>embedded-simple</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Simple Embedded Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.EmbeddedExample</clientClass>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>embedded-simple</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded-simple/readme.html
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded-simple/readme.html b/examples/broker-features/standard/embedded-simple/readme.html
new file mode 100644
index 0000000..1bbd7aa
--- /dev/null
+++ b/examples/broker-features/standard/embedded-simple/readme.html
@@ -0,0 +1,96 @@
+<!--
+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.
+-->
+
+<html>
+   <head>
+      <title>ActiveMQ Artemis Embedded JMS Server Example</title>
+      <link rel="stylesheet" type="text/css" href="../../../common/common.css" />
+      <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
+      <script type="text/javascript" src="../../../common/prettify.js"></script>
+   </head>
+   <body onload="prettyPrint()">
+      <h1>Embedded JMS Server Example</h1>
+
+      <p>This examples shows how to setup and run an embedded JMS server using ActiveMQ Artemis along with ActiveMQ Artemis configuration files.</p>
+
+      <h2>Example step-by-step</h2>
+      <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
+
+      <ol>
+         <li>Create ActiveMQ Artemis core configuration files and make sure they are within your classpath.  By default, ActiveMQ
+             expects the configuration file name to be "broker.xml".</li>
+         <li>Create an embedded ActiveMQ Artemis JMS server</li>
+         <pre class="prettyprint">
+            <code>EmbeddedJMS jmsServer = new EmbeddedJMS();</code>
+         </pre>
+
+         <li>Setup security configurations</li>
+         <pre class="prettyprint">
+            <code>SecurityConfiguration securityConfig = new SecurityConfiguration();
+            securityConfig.addUser("guest", "guest");
+            securityConfig.addRole("guest", "guest");
+            securityConfig.setDefaultUser("guest");
+            jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));</code>
+         </pre>
+
+         <li>Start the embedded ActiveMQ Artemis JMS server</li>
+         <pre class="prettyprint">
+            <code>jmsServer.start()</code>
+         </pre>
+
+         <li>Create JMS resources (connection factory and queue) for the example</li>
+         <pre class="prettyprint">
+            <code>JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
+            List<String> connectors = new ArrayList<String>();
+            connectors.add("in-vm");
+            jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
+            jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");</code>
+         </pre>
+
+         <p>At this point the JMS server is started and any JMS clients can look up JMS resources from the JNDI to send/receive
+            messages from the server. To keep the example simple, we will send and receive a JMS message from the same JVM
+            used to run the JMS server.</p>
+
+         <li>Lookup JMS resources defined in the configuration </li>
+         <pre class="prettyprint">
+            <code>ConnectionFactory cf = (ConnectionFactory)jmsServer.lookup("ConnectionFactory");
+            Queue queue = (Queue)jmsServer.lookup("queue/exampleQueue");</code>
+         </pre>
+
+         <li>Send and receive a message using JMS API</li>
+         <p>See the <a href="../queue/readme.html">Queue Example</a> for detailed steps to send and receive a JMS message</p>
+
+         <p>Finally, we stop the JMS server and its associated resources.</p>
+
+         <li>Close the connection</li>
+         <pre class="prettyprint">
+            <code>if (connection != null)
+            {
+               connection.close();
+            }</code>
+         </pre>
+
+         <li>Stop the JMS server</li>
+         <pre class="prettyprint">
+            <code>jmsServer.stop();</code>
+         </pre>
+
+      </ol>
+   </body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
new file mode 100644
index 0000000..7d00c7e
--- /dev/null
+++ b/examples/broker-features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -0,0 +1,86 @@
+/*
+ * 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 org.apache.activemq.artemis.jms.example;
+
+import org.apache.activemq.artemis.api.jms.JMSFactoryType;
+import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.jms.server.JMSServerManager;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * This example demonstrates how to run an ActiveMQ Artemis embedded with JMS
+ */
+public class EmbeddedExample {
+
+   public static void main(final String[] args) throws Exception {
+      EmbeddedJMS jmsServer = new EmbeddedJMS();
+
+      SecurityConfiguration securityConfig = new SecurityConfiguration();
+      securityConfig.addUser("guest", "guest");
+      securityConfig.addRole("guest", "guest");
+      securityConfig.setDefaultUser("guest");
+      jmsServer.setSecurityManager(new ActiveMQSecurityManagerImpl(securityConfig));
+
+      jmsServer.start();
+      System.out.println("Started Embedded JMS Server");
+
+      JMSServerManager jmsServerManager = jmsServer.getJMSServerManager();
+      List<String> connectors = new ArrayList<String>();
+      connectors.add("in-vm");
+      jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
+      jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue");
+
+      ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("ConnectionFactory");
+      Queue queue = (Queue) jmsServer.lookup("queue/exampleQueue");
+
+      // Step 10. Send and receive a message using JMS API
+      Connection connection = null;
+      try {
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer producer = session.createProducer(queue);
+         TextMessage message = session.createTextMessage("Hello sent at " + new Date());
+         System.out.println("Sending message: " + message.getText());
+         producer.send(message);
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+         connection.start();
+         TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000);
+         System.out.println("Received message:" + messageReceived.getText());
+      }
+      finally {
+         if (connection != null) {
+            connection.close();
+         }
+
+         // Step 11. Stop the JMS server
+         jmsServer.stop();
+         System.out.println("Stopped the JMS Server");
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml b/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml
new file mode 100644
index 0000000..0448e3b
--- /dev/null
+++ b/examples/broker-features/standard/embedded-simple/src/main/resources/broker.xml
@@ -0,0 +1,52 @@
+<?xml version='1.0'?>
+<!--
+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.
+-->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xmlns="urn:activemq"
+               xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+   <core xmlns="urn:activemq:core">
+
+      <persistence-enabled>false</persistence-enabled>
+
+      <connectors>
+         <connector name="in-vm">vm://0</connector>
+      </connectors>
+
+      <acceptors>
+         <acceptor name="in-vm">vm://0</acceptor>
+      </acceptors>
+
+      <!-- Other config -->
+
+      <security-settings>
+         <!--security for example queue-->
+         <security-setting match="#">
+            <permission type="createDurableQueue" roles="guest"/>
+            <permission type="deleteDurableQueue" roles="guest"/>
+            <permission type="createNonDurableQueue" roles="guest"/>
+            <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="consume" roles="guest"/>
+            <permission type="send" roles="guest"/>
+         </security-setting>
+      </security-settings>
+
+   </core>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded/pom.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded/pom.xml b/examples/broker-features/standard/embedded/pom.xml
new file mode 100644
index 0000000..ee576c4
--- /dev/null
+++ b/examples/broker-features/standard/embedded/pom.xml
@@ -0,0 +1,84 @@
+<?xml version='1.0'?>
+<!--
+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>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>1.0.1-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>embedded</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Embedded Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.EmbeddedExample</clientClass>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>embedded</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded/readme.html
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded/readme.html b/examples/broker-features/standard/embedded/readme.html
new file mode 100644
index 0000000..2da6ef7
--- /dev/null
+++ b/examples/broker-features/standard/embedded/readme.html
@@ -0,0 +1,38 @@
+<!--
+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.
+-->
+
+<html>
+   <head>
+      <title>ActiveMQ Artemis Embedded JMS Server Example</title>
+      <link rel="stylesheet" type="text/css" href="../../../common/common.css" />
+      <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
+      <script type="text/javascript" src="../../../common/prettify.js"></script>
+   </head>
+   <body onload="prettyPrint()">
+      <h1>Embedded JMS Server Example</h1>
+      <pre>To run the example, simply type <b>mvn verify</b> from this directory</pre>
+
+      <p>This examples shows how to setup and run an embedded JMS server using ActiveMQ Artemis.</p>
+      <p>ActiveMQ Artemis was designed using POJOs (Plain Old Java Objects) which means embedding ActiveMQ Artemis in your own application
+          is as simple as instantiating a few objects.</p>
+      <p>This example does not use any configuration files. The server is configured using POJOs and can be easily ported to any dependency injection framework.<br />
+         We will setup and run a full-fledged JMS server which binds its JMS resources to JNDI and can be accessed by remote clients.</p>
+
+   </body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
new file mode 100644
index 0000000..cb39fd0
--- /dev/null
+++ b/examples/broker-features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java
@@ -0,0 +1,107 @@
+/*
+ * 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 org.apache.activemq.artemis.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import java.util.ArrayList;
+import java.util.Date;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
+import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq.artemis.jms.server.config.JMSConfiguration;
+import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration;
+import org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
+import org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+
+/**
+ * This example demonstrates how to run an ActiveMQ Artemis embedded with JMS
+ */
+public final class EmbeddedExample {
+
+   public static void main(final String[] args) throws Exception {
+      // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly
+      Configuration configuration = new ConfigurationImpl();
+      configuration.setPersistenceEnabled(false);
+      configuration.setJournalDirectory("target/data/journal");
+      configuration.setSecurityEnabled(false);
+      configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
+
+      TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
+
+      configuration.getConnectorConfigurations().put("connector", connectorConfig);
+
+      // Step 2. Create the JMS configuration
+      JMSConfiguration jmsConfig = new JMSConfigurationImpl();
+
+      // Step 3. Configure the JMS ConnectionFactory
+      ArrayList<String> connectorNames = new ArrayList<String>();
+      connectorNames.add("connector");
+      ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(connectorNames).setBindings("cf");
+      jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
+
+      // Step 4. Configure the JMS Queue
+      JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1");
+      jmsConfig.getQueueConfigurations().add(queueConfig);
+
+      // Step 5. Start the JMS Server using the ActiveMQ Artemis core server and the JMS configuration
+      EmbeddedJMS jmsServer = new EmbeddedJMS();
+      jmsServer.setConfiguration(configuration);
+      jmsServer.setJmsConfiguration(jmsConfig);
+      jmsServer.start();
+      System.out.println("Started Embedded JMS Server");
+
+      // Step 6. Lookup JMS resources defined in the configuration
+      ConnectionFactory cf = (ConnectionFactory) jmsServer.lookup("cf");
+      Queue queue = (Queue) jmsServer.lookup("queue/queue1");
+
+      // Step 7. Send and receive a message using JMS API
+      Connection connection = null;
+      try {
+         connection = cf.createConnection();
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer producer = session.createProducer(queue);
+         TextMessage message = session.createTextMessage("Hello sent at " + new Date());
+         System.out.println("Sending message: " + message.getText());
+         producer.send(message);
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+         connection.start();
+         TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000);
+         System.out.println("Received message:" + messageReceived.getText());
+      }
+      finally {
+         if (connection != null) {
+            connection.close();
+         }
+
+         // Step 11. Stop the JMS server
+         jmsServer.stop();
+         System.out.println("Stopped the JMS Server");
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/expiry/pom.xml
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/expiry/pom.xml b/examples/broker-features/standard/expiry/pom.xml
new file mode 100644
index 0000000..983cc32
--- /dev/null
+++ b/examples/broker-features/standard/expiry/pom.xml
@@ -0,0 +1,110 @@
+<?xml version='1.0'?>
+<!--
+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>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>1.0.1-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>expiry</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Expiry Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <configuration>${basedir}/target/classes/activemq/server0</configuration>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <spawn>true</spawn>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.ExpiryExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>expiry</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/expiry/readme.html
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/expiry/readme.html b/examples/broker-features/standard/expiry/readme.html
new file mode 100644
index 0000000..d13cac0
--- /dev/null
+++ b/examples/broker-features/standard/expiry/readme.html
@@ -0,0 +1,61 @@
+<!--
+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.
+-->
+
+<html>
+  <head>
+    <title>ActiveMQ Artemis Message Expiration Example</title>
+    <link rel="stylesheet" type="text/css" href="../../../common/common.css" />
+    <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" />
+    <script type="text/javascript" src="../../../common/prettify.js"></script>
+  </head>
+  <body onload="prettyPrint()">
+     <h1>JMS Expiration Example</h1>
+     <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
+
+     <p>This example shows you how to configure ActiveMQ Artemis so messages are expipired after a certain time.</p>
+     <p>Messages can be retained in the messaging system for a limited period of time before being removed.
+         JMS specification states that clients should not receive messages that have been expired (but it does not guarantee this will not happen).</p>
+     <p>ActiveMQ Artemis can assign a <em>expiry address</em> to a given queue so that when messages are expired, they are removed from the queue and
+        routed to this address. These "expired" messages can later be consumed for further inspection.
+     <p>
+         The example will send 1 message with a short <em>time-to-live</em> to a queue. We will wait for the message to expire and checks that the message
+         is no longer in the queue it was sent to.
+         We will instead consume it from an <em>expiry queue</em> where it was moved when it expired.
+     </p>
+     <h2>Example setup</h2>
+     <p>Expiry destinations are defined in the configuration file <a href="server0/broker.xml">broker.xml</a>:</p>
+     <pre class="prettyprint">
+         <code>&lt;address-setting match="jms.queue.exampleQueue"&gt;
+            &lt;expiry-address&gt;jms.queue.expiryQueue&lt;/expiry-address&gt;
+         &lt;/address-setting&gt;
+         </code>
+     </pre>
+     <p>This configuration will moved expired messages from the <code>exampleQueue</code> to the <code>expiryQueue</code></p>
+     <p>ActiveMQ Artemis allows to specify either a <code>Queue</code> by prefixing the <code>expiry-address</code> with <code>jms.queue.</code>
+         or a <code>Topic</code> by prefixing with <code>jms.topic.</code>.<br />
+         In this example, we will use a <code>Queue</code> to hold the expired messages.</p>
+     <p>Since we want to consume messages from this expiryQueue, we also need to add a JNDI binding to perform a lookup.
+         This is configured in <a href="server0/activemq-jms.xml">activemq-jms.xml</a></p>
+     <pre class="prettyprint">
+         <code>&lt;queue name="expiryQueue"&gt;
+            &lt;entry name="/queue/expiryQueue"/&gt;
+         &lt;/queue&gt;</code>
+     </pre>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java b/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java
new file mode 100644
index 0000000..996da74
--- /dev/null
+++ b/examples/broker-features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.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.
+ */
+package org.apache.activemq.artemis.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * An example showing how messages are moved to an expiry queue when they expire.
+ */
+public class ExpiryExample {
+
+   public static void main(final String[] args) throws Exception {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try {
+         // Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         // Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
+
+         // Step 3. Perform a lookup on the Connection Factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
+
+         // Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         // Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         // Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         // Step 7. Messages sent by this producer will be retained for 1s (1000ms) before expiration
+         producer.setTimeToLive(1000);
+
+         // Step 8. Create a Text Message
+         TextMessage message = session.createTextMessage("this is a text message");
+
+         // Step 9. Send the Message
+         producer.send(message);
+         System.out.println("Sent message to " + queue.getQueueName() + ": " + message.getText());
+
+         // Step 10. Sleep for 5s. Once we wake up, the message will have been expired
+         System.out.println("Sleep a little bit to let the message expire...");
+         Thread.sleep(5000);
+
+         // Step 11. Create a JMS Message Consumer for the queue
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         // Step 12. Start the Connection
+         connection.start();
+
+         // Step 13. Trying to receive a message. Since there is none on the queue, the call will timeout after 5000ms
+         // and messageReceived will be null
+         TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
+         System.out.println("Received message from " + queue.getQueueName() + ": " + messageReceived);
+
+         // Step 14. Perfom a lookup on the expiry queue
+         Queue expiryQueue = (Queue) initialContext.lookup("queue/expiryQueue");
+
+         // Step 15. Create a JMS Message Consumer for the expiry queue
+         MessageConsumer expiryConsumer = session.createConsumer(expiryQueue);
+
+         // Step 16. Receive the message from the expiry queue
+         messageReceived = (TextMessage) expiryConsumer.receive(5000);
+
+         // Step 17. The message sent to the queue was moved to the expiry queue when it expired.
+         System.out.println("Received message from " + expiryQueue.getQueueName() + ": " + messageReceived.getText());
+
+         // The message received from the expiry queue has the same content than the expired message but its JMS headers
+         // differ
+         // (from JMS point of view, it's not the same message).
+         // ActiveMQ Artemis defines additional properties to correlate the message received from the expiry queue with the
+         // message expired from the queue
+
+         System.out.println();
+         // Step 18. the messageReceived's destination is now the expiry queue.
+         System.out.println("Destination of the expired message: " + ((Queue) messageReceived.getJMSDestination()).getQueueName());
+         // Step 19. and its own expiration (the time to live in the *expiry* queue)
+         System.out.println("Expiration time of the expired message (relative to the expiry queue): " + messageReceived.getJMSExpiration());
+
+         System.out.println();
+         // Step 20. the *origin* destination is stored in the _AMQ_ORIG_ADDRESS property
+         System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_AMQ_ORIG_ADDRESS"));
+         // Step 21. the actual expiration time is stored in the _AMQ_ACTUAL_EXPIRY property
+         System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_AMQ_ACTUAL_EXPIRY"));
+      }
+      finally {
+         // Step 22. Be sure to close the resources!
+         if (initialContext != null) {
+            initialContext.close();
+         }
+         if (connection != null) {
+            connection.close();
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/broker-features/standard/expiry/src/main/resources/activemq/server0/artemis-roles.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+guest=guest
\ No newline at end of file