Return-Path:
X-Original-To: apmail-activemq-commits-archive@www.apache.org
Delivered-To: apmail-activemq-commits-archive@www.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id 7876D18498
for ;
Thu, 13 Aug 2015 04:13:21 +0000 (UTC)
Received: (qmail 9556 invoked by uid 500); 13 Aug 2015 04:13:21 -0000
Delivered-To: apmail-activemq-commits-archive@activemq.apache.org
Received: (qmail 9433 invoked by uid 500); 13 Aug 2015 04:13:21 -0000
Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@activemq.apache.org
Delivered-To: mailing list commits@activemq.apache.org
Received: (qmail 8589 invoked by uid 99); 13 Aug 2015 04:13:20 -0000
Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org)
(140.211.11.23)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2015 04:13:20 +0000
Received: by git1-us-west.apache.org (ASF Mail Server at
git1-us-west.apache.org, from userid 33)
id 04678E3AA6; Thu, 13 Aug 2015 04:13:20 +0000 (UTC)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: clebertsuconic@apache.org
To: commits@activemq.apache.org
Date: Thu, 13 Aug 2015 04:13:24 -0000
Message-Id: <26924b67a9d840e0a1903181d96eb76a@git.apache.org>
In-Reply-To:
References:
X-Mailer: ASF-Git Admin Mailer
Subject: [06/48] activemq-artemis git commit: renaming broker-features ->
features on examples
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/dup-send/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/dup-send/src/main/webapp/WEB-INF/web.xml b/examples/features/standard/rest/dup-send/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..ffb38b5
--- /dev/null
+++ b/examples/features/standard/rest/dup-send/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+ rest.messaging.config.file
+ activemq-rest.xml
+
+
+
+ Rest-Messaging
+
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+
+
+
+
+ Rest-Messaging
+ /*
+
+
+
+ org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
+
+
+
+ org.apache.activemq.rest.integration.ActiveMQBootstrapListener
+
+
+
+ org.apache.activemq.rest.integration.RestMessagingBootstrapListener
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/README.txt
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/README.txt b/examples/features/standard/rest/javascript-chat/README.txt
new file mode 100644
index 0000000..ae0e57c
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/README.txt
@@ -0,0 +1,16 @@
+System Requirements:
+You will need JDK 1.6, Maven, and a browser to run this example. This example has been tested with Maven 2.2.1. It may or may not work
+with earlier or later versions of Maven.
+
+
+This is an example of producing and consuming messages through a topic. The client is Javascript code within your browser.
+The example is a very simple chat application between two browser windows.
+
+Step 1:
+$ mvn jetty:run
+
+This will bring up ActiveMQ Artemis and the ActiveMQ Artemis REST Interface.
+
+Step 2:
+Bring up two browsers and point them to http://localhost:9095. In the textbox type a message you want to send. Click
+the "Click to send message" button and you'll see the message show up in both browser windows.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/pom.xml b/examples/features/standard/rest/javascript-chat/pom.xml
new file mode 100644
index 0000000..ca7306c
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/pom.xml
@@ -0,0 +1,184 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.activemq.examples.rest
+ artemis-rests-pom
+ 1.0.1-SNAPSHOT
+
+ javascript-chat
+ war
+ Browser Chat App
+
+
+ ${project.basedir}/../../../../..
+
+
+
+
+ jboss
+ http://repository.jboss.org/nexus/content/groups/public/
+
+
+
+
+
+ example
+
+ chat
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ surefire-it
+ integration-test
+
+ test
+
+
+ false
+
+
+
+
+
+ org.mortbay.jetty
+ maven-jetty-plugin
+ 6.1.15
+
+
+ /
+ 2
+ foo
+ 9999
+
+
+ 9095
+ 60000
+
+
+
+
+
+ start-jetty
+ pre-integration-test
+
+ run
+
+
+ 0
+ true
+
+
+
+ stop-jetty
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+
+
+
+ org.apache.activemq
+ artemis-core-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-server
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-server
+ ${project.version}
+
+
+ io.netty
+ netty-all
+
+
+ org.apache.geronimo.specs
+ geronimo-jms_2.0_spec
+
+
+ org.apache.activemq.rest
+ artemis-rest
+ ${project.version}
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+
+
+ org.jboss.resteasy
+ resteasy-jaxb-provider
+
+
+ junit
+ junit
+ 4.1
+ test
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-roles.properties b/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/main/resources/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/6b17d966/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-users.properties b/examples/features/standard/rest/javascript-chat/src/main/resources/artemis-users.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/main/resources/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/6b17d966/examples/features/standard/rest/javascript-chat/src/main/resources/broker.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/main/resources/broker.xml b/examples/features/standard/rest/javascript-chat/src/main/resources/broker.xml
new file mode 100644
index 0000000..e5e1364
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/main/resources/broker.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ vm://0
+
+
+
+ vm://0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/main/webapp/WEB-INF/web.xml b/examples/features/standard/rest/javascript-chat/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..e82738a
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+ Rest-Messaging
+
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+
+
+
+
+ Rest-Messaging
+ /*
+
+
+
+ org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
+
+
+
+ org.apache.activemq.rest.integration.ActiveMQBootstrapListener
+
+
+
+ org.apache.activemq.rest.integration.RestMessagingBootstrapListener
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/main/webapp/index.html b/examples/features/standard/rest/javascript-chat/src/main/webapp/index.html
new file mode 100644
index 0000000..f74e0ee
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/main/webapp/index.html
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+ Ajax Chat Demo
+
+
+
+
+Ajax Chat Demo
+
+
+
+
+
+
+
+
+
+
Messages:
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java b/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java
new file mode 100644
index 0000000..e1609bb
--- /dev/null
+++ b/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.resteasy.messaging.test;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.Link;
+import org.apache.activemq.artemis.rest.util.LinkStrategy;
+import org.junit.Assert;
+
+public class AutoAckTopicTest {
+
+ public static Link getLinkByTitle(LinkStrategy strategy, ClientResponse response, String title) {
+ return response.getLinkHeader().getLinkByTitle(title);
+ }
+
+ //todo fix
+ //@Test
+ public void testSuccessFirst() throws Exception {
+ ClientRequest request = new ClientRequest("http://localhost:9095/topics/jms.topic.chat");
+
+ ClientResponse response = request.head();
+ Assert.assertEquals("*****", 200, response.getStatus());
+ Link sender = getLinkByTitle(null, response, "create");
+ Link subscriptions = getLinkByTitle(null, response, "subscriptions");
+
+ /*
+ ClientResponse res = subscriptions.request().post();
+ Assert.assertEquals(201, res.getStatus());
+ Link sub1 = res.getLocation();
+ Assert.assertNotNull(sub1);
+ Link consumeNext1 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+ Assert.assertNotNull(consumeNext1);
+ System.out.println("consumeNext1: " + consumeNext1);
+
+
+ res = subscriptions.request().post();
+ Assert.assertEquals(201, res.getStatus());
+ Link sub2 = res.getLocation();
+ Assert.assertNotNull(sub2);
+ Link consumeNext2 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+ Assert.assertNotNull(consumeNext1);
+
+
+ res = sender.request().body("text/plain", Integer.toString(1)).post();
+ Assert.assertEquals(201, res.getStatus());
+ res = sender.request().body("text/plain", Integer.toString(2)).post();
+ Assert.assertEquals(201, res.getStatus());
+
+ res = consumeNext1.request().post(String.class);
+ Assert.assertEquals(200, res.getStatus());
+ Assert.assertEquals("1", res.getEntity(String.class));
+ consumeNext1 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+
+ res = consumeNext1.request().post(String.class);
+ Assert.assertEquals(200, res.getStatus());
+ Assert.assertEquals("2", res.getEntity(String.class));
+ consumeNext1 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+
+ res = consumeNext2.request().post(String.class);
+ Assert.assertEquals(200, res.getStatus());
+ Assert.assertEquals("1", res.getEntity(String.class));
+ consumeNext2 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+
+ res = consumeNext2.request().post(String.class);
+ Assert.assertEquals(200, res.getStatus());
+ Assert.assertEquals("2", res.getEntity(String.class));
+ consumeNext2 = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
+ Assert.assertEquals(204, sub1.request().delete().getStatus());
+ Assert.assertEquals(204, sub2.request().delete().getStatus());
+ */
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/README.txt
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/README.txt b/examples/features/standard/rest/jms-to-rest/README.txt
new file mode 100644
index 0000000..f012d94
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/README.txt
@@ -0,0 +1,49 @@
+System Requirements:
+You will need JDK 1.6 and Maven to run this example. This example has been tested with Maven 2.2.1. It may or may not work
+with earlier or later versions of Maven.
+
+
+This is an example of mixing JMS producers and consumers with REST producers and consumers. The REST clients have been
+written in both Java using RESTEasy's client library and within the Python language. You will need Python 2.6.1 or higher
+to be able to run the Python clients.
+
+To run the example you will need 5 shell-script windows (or you'll need to run 4 processes in background)
+
+Step 1:
+$ mvn jetty:run
+
+This will bring up ActiveMQ Artemis and the ActiveMQ Artemis REST Interface.
+
+Step 2:
+$ mvn exec:java -Dexec.mainClass="RestReceive"
+
+This will bring up a Java REST client that is continuously pulling the server through a consume-next (see doco for details).
+
+Step 3:
+$ mvn exec:java -Dexec.mainClass="JmsReceive"
+
+This will bring up a Java JMS consumer that is using the MessageListener interface to consume messages. It will
+extract a Order instance from the JMS Message it receives.
+
+Step 4:
+
+$ python receiveOrder.py
+
+This runs a very simple Python program to consume messages
+
+Step 5:
+Use one of these three commands to post messages to the system. One of the receive clients will consume the message.
+
+$ mvn exec:java -Dexec.mainClass="JmsSend"
+
+A JMS client will create an Order object and send it to the queue. You'll see one of the 4 clients receive the message.
+Notice that the REST clients automatically cause the Order object to be transformed on the server and passed as XML
+to the REST client.
+
+$ mvn exec:java -Dexec.mainClass="RestSend"
+
+THis is a REST client that uses the Acknowledgement protocol to receive a message from the queue.
+
+$ python postOrder.py
+
+This is a Python client that posts one message to the queue RESTfully (of course ;) )
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/pom.xml b/examples/features/standard/rest/jms-to-rest/pom.xml
new file mode 100644
index 0000000..ecc94dc
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/pom.xml
@@ -0,0 +1,170 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.activemq.examples.rest
+ artemis-rests-pom
+ 1.0.1-SNAPSHOT
+
+ mixed-jms-rest
+ war
+ Mixed JMS and REST Producers/Consumers
+
+
+ ${project.basedir}/../../../../..
+
+
+
+
+ jboss
+ http://repository.jboss.org/nexus/content/groups/public/
+
+
+
+
+
+ example
+
+ order-flow
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ surefire-it
+ integration-test
+
+ test
+
+
+ false
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.1
+
+
+
+ java
+
+
+
+
+
+ org.mortbay.jetty
+ maven-jetty-plugin
+ 6.1.15
+
+
+ /
+ 2
+ foo
+ 9999
+
+
+ 9095
+ 60000
+
+
+
+
+
+ start-jetty
+ pre-integration-test
+
+ run
+
+
+ 0
+ true
+
+
+
+ stop-jetty
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+
+
+
+ org.apache.activemq
+ artemis-core-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-server
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-server
+ ${project.version}
+
+
+ io.netty
+ netty-all
+
+
+ org.apache.geronimo.specs
+ geronimo-jms_2.0_spec
+
+
+ org.apache.activemq.rest
+ artemis-rest
+ ${project.version}
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+
+
+ org.jboss.resteasy
+ resteasy-jaxb-provider
+
+
+ junit
+ junit
+ test
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/postOrder.py
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/postOrder.py b/examples/features/standard/rest/jms-to-rest/postOrder.py
new file mode 100644
index 0000000..3580986
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/postOrder.py
@@ -0,0 +1,44 @@
+# 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 httplib, urlparse
+
+conn = httplib.HTTPConnection("localhost:9095")
+conn.request("HEAD", "/queues/jms.queue.orders")
+res = conn.getresponse()
+createLink = res.getheader("msg-create")
+print createLink
+conn.close()
+
+createParsed = urlparse.urlparse(createLink)
+conn = httplib.HTTPConnection(createParsed.netloc)
+headers = {'Content-Type' : 'application/xml'}
+xml = """
+
+ Bill
+ $199.99
+ - iPhone4
+"""
+conn.request("POST", createParsed.path, xml, headers)
+res = conn.getresponse()
+print res.status, res.reason
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/receiveOrder.py
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/receiveOrder.py b/examples/features/standard/rest/jms-to-rest/receiveOrder.py
new file mode 100644
index 0000000..ce73f5c
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/receiveOrder.py
@@ -0,0 +1,68 @@
+# 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 httplib, urlparse
+
+conn = httplib.HTTPConnection("localhost:9095")
+conn.request("HEAD", "/queues/jms.queue.orders")
+res = conn.getresponse()
+consumersLink = res.getheader("msg-pull-consumers")
+consumersParsed = urlparse.urlparse(consumersLink)
+conn = httplib.HTTPConnection(consumersParsed.netloc)
+conn.request("POST", consumersParsed.path)
+res = conn.getresponse()
+consumeLink = res.getheader("msg-consume-next")
+session = res.getheader("Location")
+print consumeLink
+conn.close()
+
+headers = {"Accept-Wait" : "3", "Accept" : "application/xml"}
+
+try:
+ print "Waiting..."
+ while True:
+ createParsed = urlparse.urlparse(consumeLink)
+ conn = httplib.HTTPConnection(createParsed.netloc)
+ conn.request("POST", createParsed.path, None, headers)
+ res = conn.getresponse()
+ if res.status == 503:
+ consumeLink = res.getheader("msg-consume-next")
+ elif res.status == 200:
+ print "Success!"
+ data = res.read()
+ print data
+ consumeLink = res.getheader("msg-consume-next")
+ print "Waiting"
+ else:
+ raise Exception('failed')
+finally:
+ if session != None:
+ print "deleting activemq session..."
+ createParsed = urlparse.urlparse(session)
+ conn = httplib.HTTPConnection(createParsed.netloc)
+ conn.request("DELETE", createParsed.path)
+ res = conn.getresponse()
+
+
+
+
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/JmsHelper.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsHelper.java b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsHelper.java
new file mode 100644
index 0000000..ef7a575
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsHelper.java
@@ -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.
+ */
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.core.config.FileDeploymentManager;
+import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
+import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
+
+import javax.jms.ConnectionFactory;
+
+public class JmsHelper {
+
+ public static ConnectionFactory createConnectionFactory(String configFile) throws Exception {
+ FileConfiguration config = new FileConfiguration();
+ FileDeploymentManager deploymentManager = new FileDeploymentManager(configFile);
+ deploymentManager.addDeployable(config);
+ deploymentManager.readConfiguration();
+ TransportConfiguration transport = config.getConnectorConfigurations().get("netty-connector");
+ return new ActiveMQJMSConnectionFactory(ActiveMQClient.createServerLocatorWithoutHA(transport));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java
new file mode 100644
index 0000000..d3c05b2
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java
@@ -0,0 +1,55 @@
+/*
+ * 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.artemis.jms.client.ActiveMQDestination;
+import org.apache.activemq.artemis.rest.Jms;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+public class JmsReceive {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("Receive Setup...");
+ ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
+ Destination destination = (ActiveMQDestination) ActiveMQDestination.fromAddress("jms.queue.orders");
+
+ Connection conn = factory.createConnection();
+ try {
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(destination);
+ consumer.setMessageListener(new MessageListener() {
+ @Override
+ public void onMessage(Message message) {
+ System.out.println("Received Message: ");
+ Order order = Jms.getEntity(message, Order.class);
+ System.out.println(order);
+ }
+ });
+ conn.start();
+ Thread.sleep(1000000);
+ }
+ finally {
+ conn.close();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java
new file mode 100644
index 0000000..bf3370e
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java
@@ -0,0 +1,47 @@
+/*
+ * 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.artemis.jms.client.ActiveMQDestination;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+
+public class JmsSend {
+
+ public static void main(String[] args) throws Exception {
+ ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
+ Destination destination = (ActiveMQDestination) ActiveMQDestination.fromAddress("jms.queue.orders");
+
+ Connection conn = factory.createConnection();
+ try {
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(destination);
+ ObjectMessage message = session.createObjectMessage();
+
+ Order order = new Order("Bill", "$199.99", "iPhone4");
+ message.setObject(order);
+ producer.send(message);
+ }
+ finally {
+ conn.close();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/Order.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/Order.java b/examples/features/standard/rest/jms-to-rest/src/main/java/Order.java
new file mode 100644
index 0000000..2b938f7
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/Order.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+@XmlRootElement(name = "order")
+public class Order implements Serializable {
+
+ private String name;
+ private String amount;
+ private String item;
+
+ public Order() {
+ }
+
+ public Order(String name, String amount, String item) {
+ this.name = name;
+ this.amount = amount;
+ this.item = item;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAmount() {
+ return amount;
+ }
+
+ public void setAmount(String amount) {
+ this.amount = amount;
+ }
+
+ public String getItem() {
+ return item;
+ }
+
+ public void setItem(String item) {
+ this.item = item;
+ }
+
+ @Override
+ public String toString() {
+ return "Order{" +
+ "name='" + name + '\'' +
+ ", amount='" + amount + '\'' +
+ ", item='" + item + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java b/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java
new file mode 100644
index 0000000..4fc493a
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java
@@ -0,0 +1,52 @@
+/*
+ * 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.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.Link;
+
+public class RestReceive {
+
+ public static void main(String[] args) throws Exception {
+ // first get the create URL for the shipping queue
+ ClientRequest request = new ClientRequest("http://localhost:9095/queues/jms.queue.orders");
+ ClientResponse res = request.head();
+ Link pullConsumers = res.getHeaderAsLink("msg-pull-consumers");
+ res = pullConsumers.request().formParameter("autoAck", "false").post();
+ Link ackNext = res.getHeaderAsLink("msg-acknowledge-next");
+ res.releaseConnection();
+ while (true) {
+ System.out.println("Waiting...");
+ res = ackNext.request().header("Accept-Wait", "10").header("Accept", "application/xml").post();
+ if (res.getStatus() == 503) {
+ System.out.println("Timeout...");
+ ackNext = res.getHeaderAsLink("msg-acknowledge-next");
+ }
+ else if (res.getStatus() == 200) {
+ Order order = (Order) res.getEntity(Order.class);
+ System.out.println(order);
+ Link ack = res.getHeaderAsLink("msg-acknowledgement");
+ res = ack.request().formParameter("acknowledge", "true").post();
+ ackNext = res.getHeaderAsLink("msg-acknowledge-next");
+ }
+ else {
+ throw new RuntimeException("Failure! " + res.getStatus());
+ }
+ res.releaseConnection();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/java/RestSend.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/RestSend.java b/examples/features/standard/rest/jms-to-rest/src/main/java/RestSend.java
new file mode 100644
index 0000000..902c4f7
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/java/RestSend.java
@@ -0,0 +1,40 @@
+/*
+ * 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.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.Link;
+
+public class RestSend {
+
+ public static void main(String[] args) throws Exception {
+ // first get the create URL for the shipping queue
+ ClientRequest request = new ClientRequest("http://localhost:9095/queues/jms.queue.orders");
+ ClientResponse res = request.head();
+ Link create = res.getHeaderAsLink("msg-create");
+
+ System.out.println("Send order...");
+ Order order = new Order();
+ order.setName("Bill");
+ order.setItem("iPhone4");
+ order.setAmount("$199.99");
+
+ res = create.request().body("application/xml", order).post();
+ if (res.getStatus() != 201)
+ throw new RuntimeException("Failed to post");
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/resources/activemq-client.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/resources/activemq-client.xml b/examples/features/standard/rest/jms-to-rest/src/main/resources/activemq-client.xml
new file mode 100644
index 0000000..6fe4547
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/resources/activemq-client.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ tcp://localhost:61616
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-roles.properties b/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-roles.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/resources/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/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-users.properties b/examples/features/standard/rest/jms-to-rest/src/main/resources/artemis-users.properties
new file mode 100644
index 0000000..4e2d44c
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/resources/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/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/resources/broker.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/resources/broker.xml b/examples/features/standard/rest/jms-to-rest/src/main/resources/broker.xml
new file mode 100644
index 0000000..8cc0fa6
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/resources/broker.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ vm://0
+
+
+
+ vm://0
+ tcp://localhost:61616
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/jms-to-rest/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/jms-to-rest/src/main/webapp/WEB-INF/web.xml b/examples/features/standard/rest/jms-to-rest/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..e82738a
--- /dev/null
+++ b/examples/features/standard/rest/jms-to-rest/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+ Rest-Messaging
+
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+
+
+
+
+ Rest-Messaging
+ /*
+
+
+
+ org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
+
+
+
+ org.apache.activemq.rest.integration.ActiveMQBootstrapListener
+
+
+
+ org.apache.activemq.rest.integration.RestMessagingBootstrapListener
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/pom.xml b/examples/features/standard/rest/pom.xml
new file mode 100644
index 0000000..bb6c81e
--- /dev/null
+++ b/examples/features/standard/rest/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache.activemq.examples.broker
+ jms-examples
+ 1.0.1-SNAPSHOT
+
+
+ org.apache.activemq.examples.rest
+ artemis-rests-pom
+ pom
+ ActiveMQ Artemis REST Examples
+
+
+ ${project.basedir}/../../../..
+
+
+
+ javascript-chat
+ jms-to-rest
+ push
+ dup-send
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/push/README.txt
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/push/README.txt b/examples/features/standard/rest/push/README.txt
new file mode 100644
index 0000000..307e444
--- /dev/null
+++ b/examples/features/standard/rest/push/README.txt
@@ -0,0 +1,32 @@
+System Requirements:
+You will need JDK 1.6 and Maven to run this example. This example has been tested with Maven 2.2.1. It may or may not work
+with earlier or later versions of Maven.
+
+
+This is an example of having the ActiveMQ Artemis REST interface forward a posted message to a registered URL.
+
+To run the example you will need 3 shell-script windows (or you'll need to run 2 processes in background)
+
+Step 1:
+$ mvn jetty:run
+
+This will bring up ActiveMQ Artemis and the ActiveMQ Artemis REST Interface. Two queues will be created. An "order" queue and a "shipping"
+queue. The server will forward posted messages to the "shipping" queue through a registered push subscription.
+
+Step 2:
+$ mvn exec:java -Dexec.mainClass="ReceiveShipping"
+
+This will bring up a JMS client registers a MessageListener consumer to receive Order objects. It will automatically
+convert a posted HTTP message into an Order object using JAX-RS content handlers.
+
+Step 3:
+$ mvn exec:java -Dexec.mainClass="PushReg"
+
+This creates a push registration that listens on the "order" queue and forwards messages posted to it to a URL. This
+URL is the REST resource of the "shipping" queue.
+
+Step 4:
+
+$ mvn exec:java -Dexec.mainClass="PostOrder"
+
+This posts an order to the "order" queue. You'll see it eventually consumed by the ReceiveShipping process.
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/push/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/push/pom.xml b/examples/features/standard/rest/push/pom.xml
new file mode 100644
index 0000000..49eba5e
--- /dev/null
+++ b/examples/features/standard/rest/push/pom.xml
@@ -0,0 +1,176 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.activemq.examples.rest
+ artemis-rests-pom
+ 1.0.1-SNAPSHOT
+
+ push
+ war
+ Push Subscriptions
+
+
+ ${project.basedir}/../../../../..
+
+
+
+
+ jboss
+ http://repository.jboss.org/nexus/content/groups/public/
+
+
+
+
+
+ example
+
+ order-flow
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ surefire-it
+ integration-test
+
+ test
+
+
+ false
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.1
+
+
+
+ java
+
+
+
+
+
+ org.mortbay.jetty
+ maven-jetty-plugin
+ 6.1.15
+
+
+ /
+ 2
+ foo
+ 9999
+
+
+ 9095
+ 60000
+
+
+
+
+ Test
+ ${project.build.outputDirectory}/test-realm.properties
+
+
+
+
+
+ start-jetty
+ pre-integration-test
+
+ run
+
+
+ 0
+ true
+
+
+
+ stop-jetty
+ post-integration-test
+
+ stop
+
+
+
+
+
+
+
+
+
+
+ org.apache.activemq
+ artemis-core-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-server
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-client
+ ${project.version}
+
+
+ org.apache.activemq
+ artemis-jms-server
+ ${project.version}
+
+
+ io.netty
+ netty-all
+
+
+ org.apache.geronimo.specs
+ geronimo-jms_2.0_spec
+
+
+ org.apache.activemq.rest
+ artemis-rest
+ ${project.version}
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+
+
+ org.jboss.resteasy
+ resteasy-jaxb-provider
+
+
+ junit
+ junit
+ test
+
+
+
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/push/src/main/java/JmsHelper.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/push/src/main/java/JmsHelper.java b/examples/features/standard/rest/push/src/main/java/JmsHelper.java
new file mode 100644
index 0000000..add00c2
--- /dev/null
+++ b/examples/features/standard/rest/push/src/main/java/JmsHelper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.core.config.FileDeploymentManager;
+import org.apache.activemq.artemis.core.config.impl.FileConfiguration;
+import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
+
+import javax.jms.ConnectionFactory;
+
+public class JmsHelper {
+
+ public static ConnectionFactory createConnectionFactory(String configFile) throws Exception {
+ FileConfiguration config = new FileConfiguration();
+ FileDeploymentManager deploymentManager = new FileDeploymentManager(configFile);
+ deploymentManager.addDeployable(config);
+ deploymentManager.readConfiguration();
+ TransportConfiguration transport = config.getConnectorConfigurations().get("netty-connector");
+ return new ActiveMQJMSConnectionFactory(ActiveMQClient.createServerLocatorWithoutHA(transport));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/push/src/main/java/Order.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/push/src/main/java/Order.java b/examples/features/standard/rest/push/src/main/java/Order.java
new file mode 100644
index 0000000..2b938f7
--- /dev/null
+++ b/examples/features/standard/rest/push/src/main/java/Order.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+@XmlRootElement(name = "order")
+public class Order implements Serializable {
+
+ private String name;
+ private String amount;
+ private String item;
+
+ public Order() {
+ }
+
+ public Order(String name, String amount, String item) {
+ this.name = name;
+ this.amount = amount;
+ this.item = item;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAmount() {
+ return amount;
+ }
+
+ public void setAmount(String amount) {
+ this.amount = amount;
+ }
+
+ public String getItem() {
+ return item;
+ }
+
+ public void setItem(String item) {
+ this.item = item;
+ }
+
+ @Override
+ public String toString() {
+ return "Order{" +
+ "name='" + name + '\'' +
+ ", amount='" + amount + '\'' +
+ ", item='" + item + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/features/standard/rest/push/src/main/java/PostOrder.java
----------------------------------------------------------------------
diff --git a/examples/features/standard/rest/push/src/main/java/PostOrder.java b/examples/features/standard/rest/push/src/main/java/PostOrder.java
new file mode 100644
index 0000000..96786e6
--- /dev/null
+++ b/examples/features/standard/rest/push/src/main/java/PostOrder.java
@@ -0,0 +1,47 @@
+/*
+ * 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.artemis.jms.client.ActiveMQDestination;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+
+public class PostOrder {
+
+ public static void main(String[] args) throws Exception {
+ ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
+ Destination destination = (ActiveMQDestination) ActiveMQDestination.fromAddress("jms.queue.orders");
+
+ Connection conn = factory.createConnection();
+ try {
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = session.createProducer(destination);
+ ObjectMessage message = session.createObjectMessage();
+
+ Order order = new Order("Bill", "$199.99", "iPhone4");
+ message.setObject(order);
+ producer.send(message);
+ }
+ finally {
+ conn.close();
+ }
+ }
+}