http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -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 \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index fdf88cc..0000000 --- a/examples/broker-features/standard/dead-letter/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,71 +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: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="exampleQueue"/> - - <!-- the dead letter queue where dead messages will be sent--> - <queue name="deadLetterQueue"/> - </jms> - - <core xmlns="urn:activemq:core"> - - <bindings-directory>${data.dir:../data}/bindings</bindings-directory> - - <journal-directory>${data.dir:../data}/journal</journal-directory> - - <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory> - - <paging-directory>${data.dir:../data}/paging</paging-directory> - - <!-- Acceptors --> - <acceptors> - <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> - </acceptors> - - <!-- Other config --> - - <security-settings> - <!--security for example queue--> - <security-setting match="jms.#"> - <permission type="createDurableQueue" roles="guest"/> - <permission type="deleteDurableQueue" roles="guest"/> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - </security-settings> - - <address-settings> - <!--override the max-delivery-attempts and dead letter address for the example queue--> - <address-setting match="jms.queue.exampleQueue"> - <dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address> - <max-delivery-attempts>3</max-delivery-attempts> - </address-setting> - </address-settings> - - </core> -</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/dead-letter/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/dead-letter/src/main/resources/jndi.properties b/examples/broker-features/standard/dead-letter/src/main/resources/jndi.properties deleted file mode 100644 index 3e1a366..0000000 --- a/examples/broker-features/standard/dead-letter/src/main/resources/jndi.properties +++ /dev/null @@ -1,21 +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. - -java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory -connectionFactory.ConnectionFactory=tcp://localhost:61616 -queue.queue/exampleQueue=exampleQueue -queue.queue/deadLetterQueue=deadLetterQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/pom.xml b/examples/broker-features/standard/delayed-redelivery/pom.xml deleted file mode 100644 index e82469c..0000000 --- a/examples/broker-features/standard/delayed-redelivery/pom.xml +++ /dev/null @@ -1,110 +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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>jms-examples</artifactId> - <version>1.0.1-SNAPSHOT</version> - </parent> - - <artifactId>delayed-redelivery</artifactId> - <packaging>jar</packaging> - <name>ActiveMQ Artemis JMS Delayed Redelivery Example</name> - - <properties> - <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-jms-client</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-maven-plugin</artifactId> - <executions> - <execution> - <id>create</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - <ignore>${noServer}</ignore> - </configuration> - </execution> - <execution> - <id>start</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <spawn>true</spawn> - <testURI>tcp://localhost:61616</testURI> - <args> - <param>run</param> - </args> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.DelayedRedeliveryExample</clientClass> - </configuration> - </execution> - <execution> - <id>stop</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <args> - <param>stop</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>delayed-redelivery</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/readme.html b/examples/broker-features/standard/delayed-redelivery/readme.html deleted file mode 100644 index e535c47..0000000 --- a/examples/broker-features/standard/delayed-redelivery/readme.html +++ /dev/null @@ -1,56 +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. ---> - -<html> - <head> - <title>ActiveMQ Artemis Delayed Redelivery Example</title> - <link rel="stylesheet" type="text/css" href="../../../common/common.css" /> - <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" /> - <script type="text/javascript" src="../../../common/prettify.js"></script> - </head> - <body onload="prettyPrint()"> - <h1>Delayed Redelivery Example</h1> - <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre> - - <p>This example demonstrates how ActiveMQ Artemis can be configured to provide a delayed redelivery in the case - where a message needs to be redelivered.</p> - <p>Delaying redelivery can often be useful in the case that clients regularly fail or roll-back. Without a delayed - redelivery, the system can get into a "thrashing" state, with delivery being attempted, the client rolling back, and - delivery being re-attempted ad infinitum in quick succession, using up valuable CPU and network resources.</p> - <p>Re-delivery occurs when the session is closed with unacknowledged messages. The unacknowledged messages will - be redelivered.</p> - <p>By providing a redelivery delay, it can be specified that a delay of, say, 10 seconds is implemented between rollback - and redelivery. The specific delay is configurable on both a global and per destination level, by using wild-card - matching on the address settings.</p> - - <h2>Example setup</h2> - <p>Redelivery delay is specified in the configuration file <a href="src/main/resources/activemq/server0/broker.xml">broker.xml</a>:</p> - <p>In this example we set the redelivery delay to 5 seconds for the specific example queue. We could set redelivery delay on - on multiple queues by specifying a wild-card in the match, e.g. <code>match="jms.#"</code> would apply the settings - to all JMS queues and topics.</p> - <p>We then consume a message in a transacted session, and rollback, and note that the message is not redelivered until - after 5 seconds.</p> - <pre class="prettyprint"> - <code><address-setting match="jms.queue.exampleQueue"> - <redelivery-delay>5000</redelivery-delay> - </address-setting> - </code> - </pre> - </body> -</html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java b/examples/broker-features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java deleted file mode 100644 index afa538f..0000000 --- a/examples/broker-features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java +++ /dev/null @@ -1,126 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.InitialContext; - -/** - * This example demonstrates how ActiveMQ Artemis can be configured with a redelivery delay in the event a message - * is redelivered. - * - * Please see the readme.html for more information - */ -public class DelayedRedeliveryExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - InitialContext initialContext = null; - - try { - // Step 1. Create an initial context to perform the JNDI lookup. - initialContext = new InitialContext(); - - // Step 2. Perform a lookup on the queue - Queue queue = (Queue) initialContext.lookup("queue/exampleQueue"); - - // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4. Create a JMS Connection - connection = cf.createConnection(); - - // Step 5. Create a transacted JMS Session - Session session = connection.createSession(true, 0); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - // Step 7. Create a Text Message - TextMessage message = session.createTextMessage("this is a text message"); - - // Step 8. Send the Message - producer.send(message); - - System.out.println("Sent message to " + queue.getQueueName() + ": " + message.getText()); - - // Step 9. Commit the session to effectively send the message - session.commit(); - - // Step 10. Create a JMS Message Consumer for the queue - MessageConsumer messageConsumer = session.createConsumer(queue); - - // Step 11. Start the Connection - connection.start(); - - // Step 12. We receive a message... - TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); - System.out.println("1st delivery from " + queue.getQueueName() + ": " + messageReceived.getText()); - - // Step 13. ... but we roll back the session. the message returns to the queue, but only after a - // 5 second delay - session.rollback(); - - // Step 14. We try to receive the message but it's being delayed - messageReceived = (TextMessage) messageConsumer.receive(3000); - - if (messageReceived != null) { - throw new IllegalStateException("Expected to recieve message."); - } - - System.out.println("Redelivery has been delayed so received message is " + messageReceived); - - // Step 15. We try and receive the message again, this time we should get it - - messageReceived = (TextMessage) messageConsumer.receive(3000); - - System.out.println("2nd delivery from " + queue.getQueueName() + ": " + messageReceived.getText()); - - // Step 16. We rollback the session again to cause another redelivery, and we time how long this one takes - - long start = System.currentTimeMillis(); - - session.rollback(); - - messageReceived = (TextMessage) messageConsumer.receive(8000); - - long end = System.currentTimeMillis(); - - System.out.println("3nd delivery from " + queue.getQueueName() + - ": " + - messageReceived.getText() + - " after " + - (end - start) + - " milliseconds."); - } - finally { - // Step 17. Be sure to close our JMS resources! - if (initialContext != null) { - initialContext.close(); - } - if (connection != null) { - connection.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 3e41664..0000000 --- a/examples/broker-features/standard/delayed-redelivery/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,70 +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: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="exampleQueue"/> - - <!-- the dead letter queue where dead messages will be sent--> - <queue name="deadLetterQueue"/> - </jms> - - <core xmlns="urn:activemq:core"> - - <bindings-directory>${data.dir:../data}/bindings</bindings-directory> - - <journal-directory>${data.dir:../data}/journal</journal-directory> - - <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory> - - <paging-directory>${data.dir:../data}/paging</paging-directory> - - <!-- Acceptors --> - <acceptors> - <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> - </acceptors> - - <!-- Other config --> - - <security-settings> - <!--security for example queue--> - <security-setting match="jms.#"> - <permission type="createDurableQueue" roles="guest"/> - <permission type="deleteDurableQueue" roles="guest"/> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - </security-settings> - - <address-settings> - <!--override the redelivery-delay for the example queue--> - <address-setting match="jms.queue.exampleQueue"> - <redelivery-delay>5000</redelivery-delay> - </address-setting> - </address-settings> - - </core> -</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/delayed-redelivery/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/delayed-redelivery/src/main/resources/jndi.properties b/examples/broker-features/standard/delayed-redelivery/src/main/resources/jndi.properties deleted file mode 100644 index 93537c4..0000000 --- a/examples/broker-features/standard/delayed-redelivery/src/main/resources/jndi.properties +++ /dev/null @@ -1,20 +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. - -java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory -connectionFactory.ConnectionFactory=tcp://localhost:61616 -queue.queue/exampleQueue=exampleQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/pom.xml b/examples/broker-features/standard/divert/pom.xml deleted file mode 100644 index 69a7f98..0000000 --- a/examples/broker-features/standard/divert/pom.xml +++ /dev/null @@ -1,159 +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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>jms-examples</artifactId> - <version>1.0.1-SNAPSHOT</version> - </parent> - <artifactId>divert</artifactId> - <packaging>jar</packaging> - <name>ActiveMQ Artemis JMS Divert Example</name> - - <properties> - <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-server</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-jms-client</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-maven-plugin</artifactId> - <executions> - <execution> - <id>create0</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <libList><arg>org.apache.activemq.examples.broker:divert:${project.version}</arg></libList> - <instance>${basedir}/target/server0</instance> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - </configuration> - </execution> - <execution> - <id>create1</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <libList><arg>org.apache.activemq.examples.broker:divert:${project.version}</arg></libList> - <instance>${basedir}/target/server1</instance> - <configuration>${basedir}/target/classes/activemq/server1</configuration> - </configuration> - </execution> - <execution> - <id>start0</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <spawn>true</spawn> - <testURI>tcp://localhost:61616</testURI> - <args> - <param>run</param> - </args> - <name>server0</name> - </configuration> - </execution> - <execution> - <id>start1</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <spawn>true</spawn> - <location>${basedir}/target/server1</location> - <testURI>tcp://localhost:61617</testURI> - <args> - <param>run</param> - </args> - <name>server1</name> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.DivertExample</clientClass> - </configuration> - </execution> - <execution> - <id>stop0</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <location>${basedir}/target/server0</location> - <args> - <param>stop</param> - </args> - </configuration> - </execution> - <execution> - <id>stop1</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <location>${basedir}/target/server1</location> - <args> - <param>stop</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>divert</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/readme.html b/examples/broker-features/standard/divert/readme.html deleted file mode 100644 index 63fb710..0000000 --- a/examples/broker-features/standard/divert/readme.html +++ /dev/null @@ -1,119 +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. ---> - -<html> - <head> - <title>ActiveMQ Artemis Divert Example</title> - <link rel="stylesheet" type="text/css" href="../../../common/common.css" /> - <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" /> - <script type="text/javascript" src="../../../common/prettify.js"></script> - </head> - <body onload="prettyPrint()"> - <h1>Divert Example</h1> - <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre> - - <p>ActiveMQ Artemis diverts allow messages to be transparently "diverted" from one address to another - with just some simple configuration defined on the server side.</p> - <p>Diverts can be defined to be <b>exclusive</b> or <b>non-exclusive</b>.</p> - <p>With an <b>exclusive</b> divert the message is intercepted and does not get sent to the queues originally - bound to that address - it only gets diverted.</p> - <p>With a <b>non-exclusive</b> divert the message continues to go to the queues bound to the address, - but also a <b>copy</b> of the message gets sent to the address specified in the divert. Consequently non-exclusive - diverts can be used to "snoop" on another address</p> - <p>Diverts can also be configured to have an optional filter. If specified then only matching messages - will be diverted.</p> - <p>Diverts can be configured to apply a Transformer. If specified, all diverted messages will have the - opportunity of being transformed by the Transformer.</p> - <p>Diverts are a very sophisticated concept, which when combined with bridges can be used to create - interesting and complex routings. The set of diverts can be thought of as a type of <i>routing table</i> - for messages.</p> - - <h2>Example step-by-step</h2> - <p>In this example we will imagine a fictitious company which has two offices; one in London and another in New York.</p> - <p>The company accepts orders for it's products only at it's London office, and also generates price-updates - for it's products, also only from it's London office. However only the New York office is interested in receiving - price updates for New York products. Any prices for New York products need to be forwarded to the New York office.</p> - <p>There is an unreliable WAN linking the London and New York offices.</p> - <p>The company also requires a copy of any order received to be available to be inspected by management.</p> - <p>In order to achieve this, we will create a queue <code>orderQueue</code> on the London server in to which orders arrive.</p> - <p>We will create a topic, <code>spyTopic</code> on the London server, and there will be two subscribers both in London.</p> - <p>We will create a <i>non-exclusive</i> divert on the London server which will siphon off a copy of each order - received to the topic <code>spyTopic</code>.</p> - <p>Here's the xml config for that divert, from <code>broker.xml</code></p> - <pre class="prettyprint"> - <code> - <divert name="order-divert"> - <address>jms.queue.orders</address> - <forwarding-address>jms.topic.spyTopic</forwarding-address> - <exclusive>false</exclusive> - </divert> - </code> - </pre> - <p>For the prices we will create a topic on the London server, <code>priceUpdates</code> to which all price updates - are sent. We will create another topic on the New York server <code>newYorkPriceUpdates</code> to which all New York - price updates need to be forwarded.</p> - <p>Diverts can only be used to divert messages from one <b>local</b> address to another <b>local</b> address - so we cannot divert directly to an address on another server.</p> - <p>Instead we divert to a local <i>store and forward queue</i> they we define in the configuration. This is just a normal queue - that we use for storing messages before forwarding to another node.</p> - <p>Here's the configuration for it:</p> - <pre class="prettyprint"> - <code> - <queues> - <queue name="jms.queue.priceForwarding"> - <address>jms.queue.priceForwarding</address> - </queue> - </queues> - </code> - </pre> - <p>Here's the configuration for the divert:</p> - <pre class="prettyprint"> - <code> - <divert name="prices-divert"> - <address>jms.topic.priceUpdates</address> - <forwarding-address>jms.queue.priceForwarding</forwarding-address> - <filter string="office='New York'"/> - <transformer-class-name>org.apache.activemq.artemis.jms.example.AddForwardingTimeTransformer</transformer-class-name> - <exclusive>true</exclusive> - </divert> - </code> - </pre> - <p>Note we specify a filter in the divert, so only New York prices get diverted. We also specify a Transformer class - since we are going to insert a header in the message at divert time, recording the time the diversion happened.</p> - <p>And finally we define a bridge that moves messages from the local queue to the address on the New York server. - Bridges move messages from queues to remote addresses and are ideal to use when the target server may be stopped and - started independently, and/or the network might be unreliable. Bridges guarantee once and only once delivery - of messages from their source queues to their target addresses.</p> - <p>Here is the bridge configuration: </p> - <pre class="prettyprint"> - <code> - <bridges> - <bridge name="price-forward-bridge"> - <queue-name>jms.queue.priceForwarding</queue-name> - <forwarding-address>jms.topic.newYorkPriceUpdates</forwarding-address> - <reconnect-attempts>-1</reconnect-attempts> - <static-connectors> - <connector-ref>newyork-connector</connector-ref> - </static-connectors> - </bridge> - </bridges> - </code> - </pre> - </body> -</html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/AddForwardingTimeTransformer.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/AddForwardingTimeTransformer.java b/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/AddForwardingTimeTransformer.java deleted file mode 100644 index 15d8e65..0000000 --- a/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/AddForwardingTimeTransformer.java +++ /dev/null @@ -1,31 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.core.server.ServerMessage; -import org.apache.activemq.artemis.core.server.cluster.Transformer; - -public class AddForwardingTimeTransformer implements Transformer { - - public ServerMessage transform(final ServerMessage message) { - message.putLongProperty(new SimpleString("time_of_forward"), System.currentTimeMillis()); - - return message; - } - -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java b/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java deleted file mode 100644 index e014693..0000000 --- a/examples/broker-features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java +++ /dev/null @@ -1,212 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; - -import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; -import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; - -/** - * This examples demonstrates the use of ActiveMQ Artemis "Diverts" to transparently divert or copy messages - * from one address to another. - * - * Please see the readme.html for more information. - */ -public class DivertExample { - - public static void main(final String[] args) throws Exception { - Connection connectionLondon = null; - - Connection connectionNewYork = null; - try { - // Step 2. Look-up the queue orderQueue on the London server - this is the queue any orders are sent to - Queue orderQueue = ActiveMQJMSClient.createQueue("orders"); - - // Step 3. Look-up the topic priceUpdates on the London server- this is the topic that any price updates are - // sent to - Topic priceUpdates = ActiveMQJMSClient.createTopic("priceUpdates"); - - // Step 4. Look-up the spy topic on the London server- this is what we will use to snoop on any orders - Topic spyTopic = ActiveMQJMSClient.createTopic("spyTopic"); - - // Step 7. Look-up the topic newYorkPriceUpdates on the New York server - any price updates sent to - // priceUpdates on the London server will - // be diverted to the queue priceForward on the London server, and a bridge will consume from that queue and - // forward - // them to the address newYorkPriceUpdates on the New York server where they will be distributed to the topic - // subscribers on - // the New York server - Topic newYorkPriceUpdates = ActiveMQJMSClient.createTopic("newYorkPriceUpdates"); - - // Step 8. Perform a lookup on the Connection Factory on the London server - ConnectionFactory cfLondon = new ActiveMQConnectionFactory("tcp://localhost:61616"); - - // Step 9. Perform a lookup on the Connection Factory on the New York server - ConnectionFactory cfNewYork = new ActiveMQConnectionFactory("tcp://localhost:61617"); - - // Step 10. Create a JMS Connection on the London server - connectionLondon = cfLondon.createConnection(); - - // Step 11. Create a JMS Connection on the New York server - connectionNewYork = cfNewYork.createConnection(); - - // Step 12. Create a JMS Session on the London server - Session sessionLondon = connectionLondon.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 13. Create a JMS Session on the New York server - Session sessionNewYork = connectionNewYork.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 14. Create a JMS MessageProducer orderProducer that sends to the queue orderQueue on the London server - MessageProducer orderProducer = sessionLondon.createProducer(orderQueue); - - // Step 15. Create a JMS MessageProducer priceProducer that sends to the topic priceUpdates on the London - // server - MessageProducer priceProducer = sessionLondon.createProducer(priceUpdates); - - // Step 15. Create a JMS subscriber which subscribes to the spyTopic on the London server - MessageConsumer spySubscriberA = sessionLondon.createConsumer(spyTopic); - - // Step 16. Create another JMS subscriber which also subscribes to the spyTopic on the London server - MessageConsumer spySubscriberB = sessionLondon.createConsumer(spyTopic); - - // Step 17. Create a JMS MessageConsumer which consumes orders from the order queue on the London server - MessageConsumer orderConsumer = sessionLondon.createConsumer(orderQueue); - - // Step 18. Create a JMS subscriber which subscribes to the priceUpdates topic on the London server - MessageConsumer priceUpdatesSubscriberLondon = sessionLondon.createConsumer(priceUpdates); - - // Step 19. Create a JMS subscriber which subscribes to the newYorkPriceUpdates topic on the New York server - MessageConsumer newYorkPriceUpdatesSubscriberA = sessionNewYork.createConsumer(newYorkPriceUpdates); - - // Step 20. Create another JMS subscriber which also subscribes to the newYorkPriceUpdates topic on the New - // York server - MessageConsumer newYorkPriceUpdatesSubscriberB = sessionNewYork.createConsumer(newYorkPriceUpdates); - - // Step 21. Start the connections - - connectionLondon.start(); - - connectionNewYork.start(); - - // Step 22. Create an order message - TextMessage orderMessage = sessionLondon.createTextMessage("This is an order"); - - // Step 23. Send the order message to the order queue on the London server - orderProducer.send(orderMessage); - - System.out.println("Sent message: " + orderMessage.getText()); - - // Step 24. The order message is consumed by the orderConsumer on the London server - TextMessage receivedOrder = (TextMessage) orderConsumer.receive(5000); - - System.out.println("Received order: " + receivedOrder.getText()); - - // Step 25. A copy of the order is also received by the spyTopic subscribers on the London server - TextMessage spiedOrder1 = (TextMessage) spySubscriberA.receive(5000); - - System.out.println("Snooped on order: " + spiedOrder1.getText()); - - TextMessage spiedOrder2 = (TextMessage) spySubscriberB.receive(5000); - - System.out.println("Snooped on order: " + spiedOrder2.getText()); - - // Step 26. Create and send a price update message, destined for London - TextMessage priceUpdateMessageLondon = sessionLondon.createTextMessage("This is a price update for London"); - - priceUpdateMessageLondon.setStringProperty("office", "London"); - - priceProducer.send(priceUpdateMessageLondon); - - // Step 27. The price update *should* be received by the local subscriber since we only divert messages - // where office = New York - TextMessage receivedUpdate = (TextMessage) priceUpdatesSubscriberLondon.receive(2000); - - System.out.println("Received price update locally: " + receivedUpdate.getText()); - - // Step 28. The price update *should not* be received in New York - - TextMessage priceUpdate1 = (TextMessage) newYorkPriceUpdatesSubscriberA.receive(1000); - - if (priceUpdate1 != null) { - throw new IllegalStateException("Message is not null"); - } - - System.out.println("Did not received price update in New York, look it's: " + priceUpdate1); - - TextMessage priceUpdate2 = (TextMessage) newYorkPriceUpdatesSubscriberB.receive(1000); - - if (priceUpdate2 != null) { - throw new IllegalStateException("Message is not null"); - } - - System.out.println("Did not received price update in New York, look it's: " + priceUpdate2); - - // Step 29. Create a price update message, destined for New York - - TextMessage priceUpdateMessageNewYork = sessionLondon.createTextMessage("This is a price update for New York"); - - priceUpdateMessageNewYork.setStringProperty("office", "New York"); - - // Step 30. Send the price update message to the priceUpdates topic on the London server - priceProducer.send(priceUpdateMessageNewYork); - - // Step 31. The price update *should not* be received by the local subscriber to the priceUpdates topic - // since it has been *exclusively* diverted to the priceForward queue, because it has a header saying - // it is destined for the New York office - Message message = priceUpdatesSubscriberLondon.receive(1000); - - if (message != null) { - throw new IllegalStateException("Message is not null"); - } - - System.out.println("Didn't receive local price update, look, it's: " + message); - - // Step 32. The remote subscribers on server 1 *should* receive a copy of the price update since - // it has been diverted to a local priceForward queue which has a bridge consuming from it and which - // forwards it to the same address on server 1. - // We notice how the forwarded messages have had a special header added by our custom transformer that - // we told the divert to use - - priceUpdate1 = (TextMessage) newYorkPriceUpdatesSubscriberA.receive(5000); - - System.out.println("Received forwarded price update on server 1: " + priceUpdate1.getText()); - System.out.println("Time of forward: " + priceUpdate1.getLongProperty("time_of_forward")); - - priceUpdate2 = (TextMessage) newYorkPriceUpdatesSubscriberB.receive(5000); - - System.out.println("Received forwarded price update on server 2: " + priceUpdate2.getText()); - System.out.println("Time of forward: " + priceUpdate2.getLongProperty("time_of_forward")); - } - finally { - if (connectionLondon != null) { - connectionLondon.close(); - } - if (connectionNewYork != null) { - connectionNewYork.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml b/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 7ce362a..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,121 +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:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="urn:activemq" - xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> - - <jms xmlns="urn:activemq:jms"> - <!-- Destinations used by the example --> - - <!-- The order queue --> - <queue name="orders"/> - - <!-- The queue that prices are forwarded to before being bridged to the New York server --> - <queue name="priceForwarding"/> - - <!-- The topic for price updates --> - <topic name="priceUpdates"/> - - <!-- The spy topic for snooping on orders --> - <topic name="spyTopic"/> - </jms> - - <core xmlns="urn:activemq:core"> - - <bindings-directory>${data.dir:../data}/bindings</bindings-directory> - - <journal-directory>${data.dir:../data}/journal</journal-directory> - - <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory> - - <paging-directory>${data.dir:../data}/paging</paging-directory> - - <!-- Connectors --> - - <connectors> - <!-- This connector corresponds to the New York server --> - <connector name="newyork-connector">tcp://localhost:61617</connector> - </connectors> - - <!-- Acceptors --> - - <acceptors> - <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor> - </acceptors> - - <!-- Divert configuration --> - - <!-- We need to create a core queue for the JMS queue explicitly because the bridge will be deployed - before the JMS queue is deployed, so the first time, it otherwise won't find the queue --> - <queues> - <queue name="jms.queue.priceForwarding"> - <address>jms.queue.priceForwarding</address> - </queue> - </queues> - - <diverts> - <divert name="order-divert"> - <routing-name>order-divert</routing-name> - <address>jms.queue.orders</address> - <forwarding-address>jms.topic.spyTopic</forwarding-address> - <exclusive>false</exclusive> - </divert> - - <divert name="prices-divert"> - <routing-name>prices-divert</routing-name> - <address>jms.topic.priceUpdates</address> - <forwarding-address>jms.queue.priceForwarding</forwarding-address> - <filter string="office='New York'"/> - <transformer-class-name>org.apache.activemq.artemis.jms.example.AddForwardingTimeTransformer - </transformer-class-name> - <exclusive>true</exclusive> - </divert> - </diverts> - - <!-- Bridge configuration --> - - <bridges> - <bridge name="price-forward-bridge"> - <queue-name>jms.queue.priceForwarding</queue-name> - <forwarding-address>jms.topic.newYorkPriceUpdates</forwarding-address> - <reconnect-attempts>-1</reconnect-attempts> - <static-connectors> - <connector-ref>newyork-connector</connector-ref> - </static-connectors> - </bridge> - </bridges> - - <!-- Other config --> - - <security-settings> - <!--security for example --> - <security-setting match="jms.#"> - <permission type="createDurableQueue" roles="guest"/> - <permission type="deleteDurableQueue" roles="guest"/> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - </security-settings> - - </core> -</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-roles.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/artemis-users.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml b/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml deleted file mode 100644 index 315d13b..0000000 --- a/examples/broker-features/standard/divert/src/main/resources/activemq/server1/broker.xml +++ /dev/null @@ -1,64 +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:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="urn:activemq" - xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd"> - - <jms xmlns="urn:activemq:jms"> - <!-- Destinations used by the example --> - - <!-- The topic for New York price updates --> - - <topic name="newYorkPriceUpdates"/> - </jms> - - <core xmlns="urn:activemq:core"> - - <bindings-directory>${data.dir:../data}/bindings</bindings-directory> - - <journal-directory>${data.dir:../data}/journal</journal-directory> - - <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory> - - <paging-directory>${data.dir:../data}/paging</paging-directory> - - <!-- Acceptors --> - - <acceptors> - <acceptor name="netty-acceptor">tcp://localhost:61617</acceptor> - </acceptors> - - <!-- Other config --> - - <security-settings> - <!--security for example queue--> - <security-setting match="jms.#"> - <permission type="createDurableQueue" roles="guest"/> - <permission type="deleteDurableQueue" roles="guest"/> - <permission type="createNonDurableQueue" roles="guest"/> - <permission type="deleteNonDurableQueue" roles="guest"/> - <permission type="consume" roles="guest"/> - <permission type="send" roles="guest"/> - </security-setting> - </security-settings> - - </core> -</configuration> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/pom.xml ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/pom.xml b/examples/broker-features/standard/durable-subscription/pom.xml deleted file mode 100644 index a502fff..0000000 --- a/examples/broker-features/standard/durable-subscription/pom.xml +++ /dev/null @@ -1,110 +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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>jms-examples</artifactId> - <version>1.0.1-SNAPSHOT</version> - </parent> - - <artifactId>durable-subscription</artifactId> - <packaging>jar</packaging> - <name>ActiveMQ Artemis JMS Durable Subscription Example</name> - - <properties> - <activemq.basedir>${project.basedir}/../../../..</activemq.basedir> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-jms-client</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-maven-plugin</artifactId> - <executions> - <execution> - <id>create</id> - <goals> - <goal>create</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <configuration>${basedir}/target/classes/activemq/server0</configuration> - </configuration> - </execution> - <execution> - <id>start</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <spawn>true</spawn> - <testURI>tcp://localhost:61616</testURI> - <args> - <param>run</param> - </args> - </configuration> - </execution> - <execution> - <id>runClient</id> - <goals> - <goal>runClient</goal> - </goals> - <configuration> - <clientClass>org.apache.activemq.artemis.jms.example.DurableSubscriptionExample</clientClass> - </configuration> - </execution> - <execution> - <id>stop</id> - <goals> - <goal>cli</goal> - </goals> - <configuration> - <ignore>${noServer}</ignore> - <args> - <param>stop</param> - </args> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.activemq.examples.broker</groupId> - <artifactId>durable-subscription</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/readme.html ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/readme.html b/examples/broker-features/standard/durable-subscription/readme.html deleted file mode 100644 index 61b591f..0000000 --- a/examples/broker-features/standard/durable-subscription/readme.html +++ /dev/null @@ -1,39 +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. ---> - -<html> - <head> - <title>ActiveMQ Artemis JMS Durable Subscription Example</title> - <link rel="stylesheet" type="text/css" href="../../../common/common.css" /> - <link rel="stylesheet" type="text/css" href="../../../common/prettify.css" /> - <script type="text/javascript" src="../../../common/prettify.js"></script> - </head> - <body onload="prettyPrint()"> - <h1>JMS Durable Subscription Example</h1> - - <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre> - <p>This example demonstrates how to use a durable subscription with ActiveMQ Artemis.</p> - <p>Durable subscriptions are a standard part of JMS, please consult the JMS 1.1 specification for full details.</p> - <p>Unlike non durable subscriptions, the key function of durable subscriptions is that the messages contained in them - persist longer than the lifetime of the subscriber - i.e. they will accumulate messages sent to the topic even - if the subscriber is not currently connected. They will also survive server restarts. Note that for the messages to - be persisted, the messages sent to them must be marked as persistent messages.</p> - - </body> -</html> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java b/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java deleted file mode 100644 index 46cd94c..0000000 --- a/examples/broker-features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java +++ /dev/null @@ -1,116 +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. - */ -package org.apache.activemq.artemis.jms.example; - -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; -import javax.jms.TopicSubscriber; -import javax.naming.InitialContext; - -/** - * A simple JMS example that shows how to use a durable subscription. - */ -public class DurableSubscriptionExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - InitialContext initialContext = null; - try { - // Step 1. Create an initial context to perform the JNDI lookup. - initialContext = new InitialContext(); - - // Step 2. Look-up the JMS topic - Topic topic = (Topic) initialContext.lookup("topic/exampleTopic"); - - // Step 3. Look-up the JMS connection factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4. Create a JMS connection - connection = cf.createConnection(); - - // Step 5. Set the client-id on the connection - connection.setClientID("durable-client"); - - // Step 6. Start the connection - connection.start(); - - // Step 7. Create a JMS session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 8. Create a JMS message producer - MessageProducer messageProducer = session.createProducer(topic); - - // Step 9. Create the subscription and the subscriber. - TopicSubscriber subscriber = session.createDurableSubscriber(topic, "subscriber-1"); - - // Step 10. Create a text message - TextMessage message1 = session.createTextMessage("This is a text message 1"); - - // Step 11. Send the text message to the topic - messageProducer.send(message1); - - System.out.println("Sent message: " + message1.getText()); - - // Step 12. Consume the message from the durable subscription - - TextMessage messageReceived = (TextMessage) subscriber.receive(); - - System.out.println("Received message: " + messageReceived.getText()); - - // Step 13. Create and send another message - - TextMessage message2 = session.createTextMessage("This is a text message 2"); - - messageProducer.send(message2); - - System.out.println("Sent message: " + message2.getText()); - - // Step 14. Close the subscriber - the server could even be stopped at this point! - subscriber.close(); - - // Step 15. Create a new subscriber on the *same* durable subscription. - - subscriber = session.createDurableSubscriber(topic, "subscriber-1"); - - // Step 16. Consume the message - - messageReceived = (TextMessage) subscriber.receive(); - - System.out.println("Received message: " + messageReceived.getText()); - - // Step 17. Close the subscriber - subscriber.close(); - - // Step 18. Delete the durable subscription - session.unsubscribe("subscriber-1"); - } - finally { - if (connection != null) { - // Step 19. Be sure to close our JMS resources! - connection.close(); - } - if (initialContext != null) { - // Step 20. Also close the initialContext! - initialContext.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-roles.properties +++ /dev/null @@ -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 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6b17d966/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties b/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/broker-features/standard/durable-subscription/src/main/resources/activemq/server0/artemis-users.properties +++ /dev/null @@ -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 \ No newline at end of file