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/13 06:13:24 UTC
[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 @@
+<?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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+ <context-param>
+ <param-name>rest.messaging.config.file</param-name>
+ <param-value>activemq-rest.xml</param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>Rest-Messaging</filter-name>
+ <filter-class>
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+ </filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Rest-Messaging</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
+ </listener>
+
+</web-app>
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 @@
+<?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.rest</groupId>
+ <artifactId>artemis-rests-pom</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>javascript-chat</artifactId>
+ <packaging>war</packaging>
+ <name>Browser Chat App</name>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/../../../../..</activemq.basedir>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>example</id>
+ <build>
+ <finalName>chat</finalName>
+ <plugins>
+ <!--
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.15</version>
+ <configuration>
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>2</scanIntervalSeconds>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9095</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ <systemProperties>
+ <systemProperty>
+ <name>log4j.configuration</name>
+ <value>
+ file:./src/test/resources/log4j.properties
+ </value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.15</version>
+ <configuration>
+ <!-- By default the artifactId is taken, override it with something simple -->
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>2</scanIntervalSeconds>
+ <stopKey>foo</stopKey>
+ <stopPort>9999</stopPort>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9095</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-core-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_2.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq.rest</groupId>
+ <artifactId>artemis-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
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 @@
+<?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 queue used by the example-->
+ <topic name="chat"/>
+ </jms>
+
+ <core xmlns="urn:activemq:core">
+
+ <persistence-enabled>false</persistence-enabled>
+ <!-- Connectors -->
+
+ <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/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 @@
+<?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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+ <filter>
+ <filter-name>Rest-Messaging</filter-name>
+ <filter-class>
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+ </filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Rest-Messaging</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
+ </listener>
+
+</web-app>
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 @@
+<!--
+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.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <script type="text/javascript">
+ <!--
+
+ function createXHR()
+ {
+ var request = false;
+ try
+ {
+ request = new ActiveXObject('Msxml2.XMLHTTP');
+ }
+ catch (err2)
+ {
+ try
+ {
+ request = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ catch (err3)
+ {
+ try
+ {
+ request = new XMLHttpRequest();
+ }
+ catch (err1)
+ {
+ request = false;
+ }
+ }
+ }
+ return request;
+ }
+
+ var topicSender;
+ var nextMessage;
+ var subscriptions;
+ var count = 0;
+ var reconnect = true;
+
+ function initializeSenderAndTop(topic)
+ {
+ var xhr = createXHR();
+ xhr.open("HEAD", "topics/" + topic, true);
+ xhr.onreadystatechange = function()
+ {
+ if (xhr.readyState == 4)
+ {
+ if (xhr.status == 200)
+ {
+ // getting the links from the rest resource
+ topicSender = xhr.getResponseHeader("msg-create");
+ subscriptions = xhr.getResponseHeader("msg-pull-subscriptions");
+
+ // just adding the report
+ document.getElementById("errors").innerHTML = "Subscriptions URL: " + subscriptions;
+ }
+ }
+ }
+
+ // this will send the request from javascript
+ xhr.send(null);
+ }
+
+ function postMessage(user, message)
+ {
+ var xhr = createXHR();
+ xhr.open("POST", topicSender, false);
+ xhr.setRequestHeader("Content-Type", "text/plain");
+ xhr.send(user + ": " + message);
+ if (xhr.status == 201)
+ {
+ topicSender = xhr.getResponseHeader("msg-create-next");
+ }
+ else
+ {
+ document.getElementById("errors").innerHTML = "Failed to send message: " + topicSender;
+ }
+ }
+
+ function receiveMessage()
+ {
+ var xhr = createXHR();
+ if (reconnect)
+ {
+ document.getElementById("connection").innerHTML = "Trying to reconnect: " + subscriptions + " retries: " + count++;
+ xhr.open("POST", subscriptions, true);
+ xhr.onreadystatechange = function()
+ {
+ if (xhr.readyState == 4)
+ {
+ var status = xhr.status;
+ if (status == 201)
+ {
+ nextMessage = xhr.getResponseHeader("msg-consume-next");
+ document.getElementById("connection").innerHTML = "Connected to: " + nextMessage;
+ count = 1;
+ reconnect = false;
+ }
+ setTimeout("receiveMessage()", 800);
+ }
+ }
+ xhr.send(null);
+ }
+ else
+ {
+ xhr.open("POST", nextMessage, true);
+ xhr.setRequestHeader("Accept-Wait", "10")
+ xhr.onreadystatechange = function()
+ {
+ if (xhr.readyState == 4)
+ {
+ var status = xhr.status;
+ if (status == 200)
+ {
+ document.getElementById("next").innerHTML = xhr.responseText + "\n" + document.getElementById("next").innerHTML;
+ nextMessage = xhr.getResponseHeader("msg-consume-next");
+ }
+ else
+ {
+ reconnect = true;
+ }
+ setTimeout("receiveMessage()", 800);
+ }
+ }
+ xhr.send(null);
+ }
+ }
+
+ initializeSenderAndTop('jms.topic.chat');
+
+
+ setTimeout("receiveMessage()", 800);
+
+
+ // -->
+ </script>
+ <title>Ajax Chat Demo</title></head>
+
+
+<body bgcolor="#FFFFFF">
+
+<p><font size="+3">Ajax Chat Demo</font></p>
+<hr>
+<FORM name="ajax" method="POST" action="">
+
+ <p>
+ Username: <input type="text" name="user" value="Billy" size="10"><br/>
+ <input type="text" name="message">
+ <INPUT type="BUTTON" value=" Click to send message "
+ ONCLICK="postMessage(this.form.user.value, this.form.message.value)">
+ </p>
+
+</FORM>
+<div id="connection"></div>
+<br>
+
+<div id="errors"></div>
+
+<p>
+
+<h2>Messages:</h2></p>
+<pre>
+<div id="next"></div>
+</pre>
+
+</body>
+</html>
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 @@
+<?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.rest</groupId>
+ <artifactId>artemis-rests-pom</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>mixed-jms-rest</artifactId>
+ <packaging>war</packaging>
+ <name>Mixed JMS and REST Producers/Consumers</name>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/../../../../..</activemq.basedir>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>example</id>
+ <build>
+ <finalName>order-flow</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.15</version>
+ <configuration>
+ <!-- By default the artifactId is taken, override it with something simple -->
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>2</scanIntervalSeconds>
+ <stopKey>foo</stopKey>
+ <stopPort>9999</stopPort>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9095</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-core-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_2.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq.rest</groupId>
+ <artifactId>artemis-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
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 = """<?xml version="1.0"?>
+<order>
+ <name>Bill</name>
+ <amount>$199.99</amount>
+ <item>iPhone4</item>
+</order>"""
+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 @@
+<?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="urn:activemq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+ <jms xmlns="urn:activemq:jms">
+ </jms>
+
+ <core xmlns="urn:activemq:core">
+
+ <!-- Connectors -->
+ <connectors>
+ <connector name="netty-connector">tcp://localhost:61616</connector>
+ </connectors>
+ </core>
+
+</configuration>
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 @@
+<?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 queue used by the example-->
+ <queue name="orders"/>
+ </jms>
+
+ <core xmlns="urn:activemq:core">
+
+ <persistence-enabled>false</persistence-enabled>
+ <!-- Connectors -->
+
+ <connectors>
+ <connector name="in-vm">vm://0</connector>
+ </connectors>
+
+ <acceptors>
+ <acceptor name="in-vm">vm://0</acceptor>
+ <acceptor name="netty-acceptor">tcp://localhost:61616</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/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 @@
+<?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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+ <filter>
+ <filter-name>Rest-Messaging</filter-name>
+ <filter-class>
+ org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
+ </filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Rest-Messaging</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
+ </listener>
+
+</web-app>
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 @@
+<?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>
+
+ <groupId>org.apache.activemq.examples.rest</groupId>
+ <artifactId>artemis-rests-pom</artifactId>
+ <packaging>pom</packaging>
+ <name>ActiveMQ Artemis REST Examples</name>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+ </properties>
+
+ <modules>
+ <module>javascript-chat</module>
+ <module>jms-to-rest</module>
+ <module>push</module>
+ <module>dup-send</module>
+ </modules>
+</project>
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 @@
+<?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.rest</groupId>
+ <artifactId>artemis-rests-pom</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>push</artifactId>
+ <packaging>war</packaging>
+ <name>Push Subscriptions</name>
+
+ <properties>
+ <activemq.basedir>${project.basedir}/../../../../..</activemq.basedir>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>example</id>
+ <build>
+ <finalName>order-flow</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.15</version>
+ <configuration>
+ <!-- By default the artifactId is taken, override it with something simple -->
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>2</scanIntervalSeconds>
+ <stopKey>foo</stopKey>
+ <stopPort>9999</stopPort>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9095</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ <userRealms>
+ <userRealm implementation="org.mortbay.jetty.security.HashUserRealm">
+ <name>Test</name>
+ <config>${project.build.outputDirectory}/test-realm.properties</config>
+ </userRealm>
+ </userRealms>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-core-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_2.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq.rest</groupId>
+ <artifactId>artemis-rest</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
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();
+ }
+ }
+}