ARTEMIS-602 Fix REST examples

This commit is contained in:
jbertram 2016-06-30 13:04:04 -05:00 committed by Clebert Suconic
parent 9214f504a9
commit beda16b050
47 changed files with 63 additions and 557 deletions

View File

@ -158,6 +158,8 @@
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<type>jar</type>
<classifier>uber</classifier>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>

View File

@ -85,7 +85,7 @@
<include>io.airlift:airline</include>
<include>com.google.guava:guava</include>
<include>javax.inject:javax.inject</include>
<include>org.eclipse.jetty.aggregate:jetty-all</include>
<include>org.eclipse.jetty.aggregate:jetty-all:jar:uber</include>
<include>org.apache.tomcat:tomcat-servlet-api</include>
<include>commons-beanutils:commons-beanutils</include>
<include>commons-logging:commons-logging</include>

View File

@ -51,6 +51,8 @@
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<type>jar</type>
<classifier>uber</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>

View File

@ -1,5 +1,5 @@
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
You will need JDK 1.8 and Maven to run this example. This example has been tested with Maven 3.3.3. It may or may not work
with earlier or later versions of Maven.

View File

@ -33,13 +33,6 @@ under the License.
<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>
@ -78,21 +71,13 @@ under the License.
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.15</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</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>

View File

@ -23,7 +23,7 @@ public class PostOrder {
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");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link create = res.getHeaderAsLink("msg-create");

View File

@ -26,7 +26,7 @@ public class PostOrderWithId {
throw new RuntimeException("You must pass in a parameter");
// first get the create URL for the shipping queue
ClientRequest request = new ClientRequest("http://localhost:9095/queues/jms.queue.orders");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link create = res.getHeaderAsLink("msg-create-with-id");

View File

@ -23,7 +23,7 @@ public class ReceiveOrder {
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");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link pullConsumers = res.getHeaderAsLink("msg-pull-consumers");
res.releaseConnection();

View File

@ -1,36 +0,0 @@
<?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>

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -28,32 +28,11 @@ under the License.
</jms>
<core xmlns="urn:activemq:core">
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<connectors>
<connector name="in-vm">vm://0</connector>
</connectors>
<security-enabled>false</security-enabled>
<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>

View File

@ -45,11 +45,11 @@ under the License.
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>
</web-app>

View File

@ -1,5 +1,5 @@
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
You will need JDK 1.8 and Maven to run this example. This example has been tested with Maven 3.3.3. It may or may not work
with earlier or later versions of Maven.
@ -12,5 +12,5 @@ $ 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
Bring up two browsers and point them to http://localhost:8080. 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.

View File

@ -33,13 +33,6 @@ under the License.
<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>
@ -91,21 +84,13 @@ under the License.
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.15</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</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>

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -28,31 +28,11 @@ under the License.
</jms>
<core xmlns="urn:activemq:core">
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<connectors>
<connector name="in-vm">vm://0</connector>
</connectors>
<security-enabled>false</security-enabled>
<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>

View File

@ -41,11 +41,11 @@ under the License.
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>
</web-app>

View File

@ -31,7 +31,7 @@ public class AutoAckTopicTest {
//todo fix
//@Test
public void testSuccessFirst() throws Exception {
ClientRequest request = new ClientRequest("http://localhost:9095/topics/jms.topic.chat");
ClientRequest request = new ClientRequest("http://localhost:8080/topics/jms.topic.chat");
ClientResponse response = request.head();
Assert.assertEquals("*****", 200, response.getStatus());

View File

@ -1,5 +1,5 @@
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
You will need JDK 1.8 and Maven to run this example. This example has been tested with Maven 3.3.3. It may or may not work
with earlier or later versions of Maven.

View File

@ -33,13 +33,6 @@ under the License.
<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>
@ -78,21 +71,13 @@ under the License.
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.15</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</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>

View File

@ -5,9 +5,9 @@
# 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
@ -16,7 +16,7 @@
# under the License.
import httplib, urlparse
conn = httplib.HTTPConnection("localhost:9095")
conn = httplib.HTTPConnection("localhost:8080")
conn.request("HEAD", "/queues/jms.queue.orders")
res = conn.getresponse()
createLink = res.getheader("msg-create")

View File

@ -5,9 +5,9 @@
# 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
@ -16,7 +16,7 @@
# under the License.
import httplib, urlparse
conn = httplib.HTTPConnection("localhost:9095")
conn = httplib.HTTPConnection("localhost:8080")
conn.request("HEAD", "/queues/jms.queue.orders")
res = conn.getresponse()
consumersLink = res.getheader("msg-pull-consumers")
@ -55,9 +55,9 @@ finally:
conn = httplib.HTTPConnection(createParsed.netloc)
conn.request("DELETE", createParsed.path)
res = conn.getresponse()

View File

@ -1,38 +0,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.
*/
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));
}
}

View File

@ -16,6 +16,7 @@
*/
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.rest.Jms;
import javax.jms.Connection;
@ -30,7 +31,7 @@ public class JmsReceive {
public static void main(String[] args) throws Exception {
System.out.println("Receive Setup...");
ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
ConnectionFactory factory = new ActiveMQJMSConnectionFactory("tcp://localhost:61616");
Destination destination = ActiveMQDestination.fromAddress("jms.queue.orders");
try (Connection conn = factory.createConnection()) {

View File

@ -16,6 +16,7 @@
*/
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@ -27,7 +28,7 @@ import javax.jms.Session;
public class JmsSend {
public static void main(String[] args) throws Exception {
ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
ConnectionFactory factory = new ActiveMQJMSConnectionFactory("tcp://localhost:61616");
Destination destination = ActiveMQDestination.fromAddress("jms.queue.orders");
try (Connection conn = factory.createConnection()) {

View File

@ -23,7 +23,7 @@ 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");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link pullConsumers = res.getHeaderAsLink("msg-pull-consumers");
res = pullConsumers.request().formParameter("autoAck", "false").post();

View File

@ -23,7 +23,7 @@ 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");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link create = res.getHeaderAsLink("msg-create");

View File

@ -1,36 +0,0 @@
<?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>

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -28,32 +28,12 @@ under the License.
</jms>
<core xmlns="urn:activemq:core">
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<connectors>
<connector name="in-vm">vm://0</connector>
</connectors>
<security-enabled>false</security-enabled>
<acceptors>
<acceptor name="in-vm">vm://0</acceptor>
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
<acceptor name="netty">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>

View File

@ -41,11 +41,11 @@ under the License.
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>
</web-app>

View File

@ -1,5 +1,5 @@
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
You will need JDK 1.8 and Maven to run this example. This example has been tested with Maven 3.3.3. It may or may not work
with earlier or later versions of Maven.

View File

@ -78,27 +78,13 @@ under the License.
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.15</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</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>

View File

@ -1,37 +0,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.
*/
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));
}
}

View File

@ -16,6 +16,7 @@
*/
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@ -27,7 +28,7 @@ import javax.jms.Session;
public class PostOrder {
public static void main(String[] args) throws Exception {
ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
ConnectionFactory factory = new ActiveMQJMSConnectionFactory("tcp://localhost:61616");
Destination destination = ActiveMQDestination.fromAddress("jms.queue.orders");
try (Connection conn = factory.createConnection()) {

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
import org.apache.activemq.artemis.rest.queue.push.xml.Authentication;
import org.apache.activemq.artemis.rest.queue.push.xml.BasicAuth;
import org.apache.activemq.artemis.rest.queue.push.xml.PushRegistration;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.jboss.resteasy.client.ClientRequest;
@ -27,21 +25,15 @@ public class PushReg {
public static void main(String[] args) throws Exception {
// get the push consumers factory resource
ClientRequest request = new ClientRequest("http://localhost:9095/queues/jms.queue.orders");
ClientRequest request = new ClientRequest("http://localhost:8080/queues/jms.queue.orders");
ClientResponse res = request.head();
Link pushConsumers = res.getHeaderAsLink("msg-push-consumers");
// next create the XML document that represents the registration
// Really, just create a link with the shipping URL and the type you want posted
PushRegistration reg = new PushRegistration();
BasicAuth authType = new BasicAuth();
authType.setUsername("guest");
authType.setPassword("guest");
Authentication auth = new Authentication();
auth.setType(authType);
reg.setAuthenticationMechanism(auth);
XmlLink target = new XmlLink();
target.setHref("http://localhost:9095/queues/jms.queue.shipping");
target.setHref("http://localhost:8080/queues/jms.queue.shipping");
target.setType("application/xml");
target.setRelationship("destination");
reg.setTarget(target);

View File

@ -16,6 +16,7 @@
*/
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.rest.Jms;
import javax.jms.Connection;
@ -29,7 +30,7 @@ import javax.jms.Session;
public class ReceiveShipping {
public static void main(String[] args) throws Exception {
ConnectionFactory factory = JmsHelper.createConnectionFactory("activemq-client.xml");
ConnectionFactory factory = new ActiveMQJMSConnectionFactory("tcp://localhost:61616");
Destination destination = ActiveMQDestination.fromAddress("jms.queue.shipping");
try (Connection conn = factory.createConnection()) {

View File

@ -1,36 +0,0 @@
<?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>

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -29,32 +29,12 @@ under the License.
</jms>
<core xmlns="urn:activemq:core">
<persistence-enabled>false</persistence-enabled>
<!-- Connectors -->
<connectors>
<connector name="in-vm">vm://0</connector>
</connectors>
<security-enabled>false</security-enabled>
<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>

View File

@ -1,18 +0,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.
guest: guest,admin

View File

@ -41,30 +41,11 @@ under the License.
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.ActiveMQBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.activemq.rest.integration.RestMessagingBootstrapListener</listener-class>
<listener-class>org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>
<security-constraint>
<web-resource-collection>
<web-resource-name>Resteasy</web-resource-name>
<url-pattern>/queues/jms.queue.shipping/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Test</realm-name>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>

View File

@ -76,7 +76,7 @@
<fuse.mqtt.client.version>1.10</fuse.mqtt.client.version>
<guava.version>18.0</guava.version>
<jboss.logging.version>3.3.0.Final</jboss.logging.version>
<jetty.version>9.2.11.v20150529</jetty.version>
<jetty.version>9.3.10.v20160621</jetty.version>
<jgroups.version>3.6.9.Final</jgroups.version>
<maven.assembly.plugin.version>2.4</maven.assembly.plugin.version>
<netty.version>4.0.32.Final</netty.version>
@ -517,6 +517,8 @@
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
<classifier>uber</classifier>
<!-- License: (Joint): Apache 2.0 & EPL 1.0 -->
</dependency>
<dependency>