Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ACA8A18694 for ; Wed, 12 Aug 2015 03:46:57 +0000 (UTC) Received: (qmail 56973 invoked by uid 500); 12 Aug 2015 03:46:57 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 56878 invoked by uid 500); 12 Aug 2015 03:46:57 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 55304 invoked by uid 99); 12 Aug 2015 03:46:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Aug 2015 03:46:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 51C75E188E; Wed, 12 Aug 2015 03:46:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Wed, 12 Aug 2015 03:47:15 -0000 Message-Id: <6ff849e71a9247b49ba7c3f2a95864af@git.apache.org> In-Reply-To: <9f945b5dbf20413381634a841d402097@git.apache.org> References: <9f945b5dbf20413381634a841d402097@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/52] [abbrv] [partial] activemq-artemis git commit: This commit has improvements on the examples including: http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/common/prettify.css ---------------------------------------------------------------------- diff --git a/examples/jms/common/prettify.css b/examples/jms/common/prettify.css deleted file mode 100755 index 334960b..0000000 --- a/examples/jms/common/prettify.css +++ /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. - */ - -.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}pre.prettyprint{padding:2px;border:1px solid #888}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/common/prettify.js ---------------------------------------------------------------------- diff --git a/examples/jms/common/prettify.js b/examples/jms/common/prettify.js deleted file mode 100755 index 6365598..0000000 --- a/examples/jms/common/prettify.js +++ /dev/null @@ -1,42 +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. - */ - -function H(){var x=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);H=function(){return x};return x}(function(){function x(b){b=b.split(/ /g);var a={};for(var c=b.length;--c>=0;){var d=b[c];if(d)a[d]=null}return a}var y="break continue do else for if return while ",U=y+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile ",D=U+"catch class delete false import new operator private protected public this throw true try ", -I=D+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",J=D+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",V=J+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ", -K=D+"debugger eval export function get null set undefined var with Infinity NaN ",L="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",M=y+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",N=y+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ", -O=y+"case done elif esac eval fi function in local set then until ",W=I+V+K+L+M+N+O;function X(b){return b>="a"&&b<="z"||b>="A"&&b<="Z"}function u(b,a,c,d){b.unshift(c,d||0);try{a.splice.apply(a,b)}finally{b.splice(0,2)}}var Y=(function(){var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue", -"delete","do","else","finally","instanceof","return","throw","try","typeof"],a="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";for(var c=0;c:&])/g,"\\$1")}a+="|^)\\s*$";return new RegExp(a)})(),P=/&/g,Q=//g,Z=/\"/g;function $(b){return b.replace(P,"&").replace(Q,"<").replace(R,">").replace(Z,""")}function E(b){return b.replace(P,"&").replace(Q,"<").replace(R,">")}var aa= -/</g,ba=/>/g,ca=/'/g,da=/"/g,ea=/&/g,fa=/ /g;function ga(b){var a=b.indexOf("&");if(a<0)return b;for(--a;(a=b.indexOf("&#",a+1))>=0;){var c=b.indexOf(";",a);if(c>=0){var d=b.substring(a+3,c),g=10;if(d&&d.charAt(0)==="x"){d=d.substring(1);g=16}var e=parseInt(d,g);if(!isNaN(e))b=b.substring(0,a)+String.fromCharCode(e)+b.substring(c+1)}}return b.replace(aa,"<").replace(ba,">").replace(ca,"'").replace(da,'"').replace(ea,"&").replace(fa," ")}function S(b){return"XMP"===b.tagName} -function z(b,a){switch(b.nodeType){case 1:var c=b.tagName.toLowerCase();a.push("<",c);for(var d=0;d");for(var e=b.firstChild;e;e=e.nextSibling)z(e,a);if(b.firstChild||!/^(?:br|link|img)$/.test(c))a.push("");break;case 2:a.push(b.name.toLowerCase(),'="',$(b.value),'"');break;case 3:case 4:a.push(E(b.nodeValue));break}}var F=null;function ha(b){if(null===F){var a=document.createElement("PRE"); -a.appendChild(document.createTextNode('\n'));F=!/=0;i-=" ".length)d.push(" ".substring(0,i));g=e+1;break; -case "\n":a=0;break;default:++a}}if(!d)return c;d.push(c.substring(g));return d.join("")}}var ja=/(?:[^<]+| - - - 4.0.0 - - - org.apache.activemq.examples.jms - jms-examples - 1.0.1-SNAPSHOT - - - consumer-rate-limit - jar - ActiveMQ Artemis JMS Consumer Rate Limit Example - - - ${project.basedir}/../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - noServer - - true - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${noServer} - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.ConsumerRateLimitExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.jms - consumer-rate-limit - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/consumer-rate-limit/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/consumer-rate-limit/readme.html b/examples/jms/consumer-rate-limit/readme.html deleted file mode 100644 index 8b7c9e2..0000000 --- a/examples/jms/consumer-rate-limit/readme.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - ActiveMQ Artemis JMS Message Consumer Rate Limiting - - - - - -

JMS Message Consumer Rate Limiting

-
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

With ActiveMQ Artemis you can specify a maximum consume rate at which a JMS MessageConsumer will consume messages. - This can be specified when creating or configuring the connection factory. See jndi.properties.

-

If this value is specified then ActiveMQ Artemis will ensure that messages are never consumed at a rate higher than - the specified rate. This is a form of consumer throttling.

-

Example step-by-step

-

In this example we specify a consumer-max-rate of 10 messages per second in the jndi.properties - file when configuring the connection factory:

-
-     
-connectionFactory.ConnectionFactory=tcp://localhost:61616?consumerMaxRate=10
-     
-     
-

We then simply consume as many messages as we can in 10 seconds and note how many messages are actually consumed.

-

We note that the number of messages consumed per second never exceeds the specified value of 10 messages per second.

- - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java ---------------------------------------------------------------------- diff --git a/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java b/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java deleted file mode 100644 index f49a2fc..0000000 --- a/examples/jms/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.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.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.naming.InitialContext; -import java.lang.Exception; - -/** - * This example demonstrates how a message consumer can be limited to consumer messages at a maximum rate - * specified in messages per sec. - */ -public class ConsumerRateLimitExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - InitialContext initialContext = null; - try { - // Step 1. Create an initial context to perform the JNDI lookup. - initialContext = new InitialContext(); - - // Step 2. Perfom a lookup on the queue - Queue queue = (Queue) initialContext.lookup("queue/exampleQueue"); - - // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4. Create a JMS Connection - connection = cf.createConnection(); - - // Step 5. Create a JMS Session - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - - // Step 6. Create a JMS Message Producer - MessageProducer producer = session.createProducer(queue); - - // Step 7. Create a JMS Message Consumer - - MessageConsumer consumer = session.createConsumer(queue); - - // Step 8. Start the connection - - connection.start(); - - // Step 9. Send a bunch of messages - - final int numMessages = 150; - - for (int i = 0; i < numMessages; i++) { - TextMessage message = session.createTextMessage("This is text message: " + i); - - producer.send(message); - } - - System.out.println("Sent messages"); - - System.out.println("Will now try and consume as many as we can in 10 seconds ..."); - - // Step 10. Consume as many messages as we can in 10 seconds - - final long duration = 10000; - - int i = 0; - - long start = System.currentTimeMillis(); - - while (System.currentTimeMillis() - start <= duration) { - TextMessage message = (TextMessage) consumer.receive(2000); - - if (message == null) { - throw new RuntimeException("Message was null"); - } - - i++; - } - - long end = System.currentTimeMillis(); - - double rate = 1000 * (double) i / (end - start); - - System.out.println("We consumed " + i + " messages in " + (end - start) + " milliseconds"); - - System.out.println("Actual consume rate was " + rate + " messages per second"); - } - finally { - // Step 9. Be sure to close our resources! - if (initialContext != null) { - initialContext.close(); - } - - if (connection != null) { - connection.close(); - } - } - } -} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties b/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties deleted file mode 100644 index 74729fe..0000000 --- a/examples/jms/consumer-rate-limit/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?consumerMaxRate=10 -queue.queue/exampleQueue=exampleQueue http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/dead-letter/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/pom.xml b/examples/jms/dead-letter/pom.xml deleted file mode 100644 index 5a39fd4..0000000 --- a/examples/jms/dead-letter/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.jms - jms-examples - 1.0.1-SNAPSHOT - - - dead-letter - jar - ActiveMQ Artemis JMS Dead Letter Example - - - ${project.basedir}/../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - noServer - - true - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${basedir}/target/classes/activemq/server0 - ${noServer} - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.DeadLetterExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.jms - dead-letter - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/dead-letter/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/readme.html b/examples/jms/dead-letter/readme.html deleted file mode 100644 index deb836d..0000000 --- a/examples/jms/dead-letter/readme.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - ActiveMQ Artemis Dead Letter Example - - - - - -

Dead Letter Example

-
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

This example shows you how to define and deal with dead letter messages.

-

Messages can be delivered unsuccessfully (e.g. if the transacted session used to consume them is rolled back). - Such a message goes back to the JMS destination ready to be redelivered. - However, this means it is possible for a message to be delivered again and again without any success and remain in the destination, clogging the system.

-

To prevent this, messaging systems define dead letter messages: after a specified unsuccessful delivery attempts, the message is removed from the destination - and instead routed to a dead letter address where they can be consumed for further investigation. -

- The example will show how to configure ActiveMQ Artemis to route a message to a dead letter address after 3 unsuccessful delivery attempts.
- The example will send 1 message to a queue. We will deliver the message 3 times and rollback the session every time.
- On the 4th attempt, there won't be any message to consume: it will have been moved to a dead letter address.
- We will then consume this dead letter message. -

-

Example setup

-

Dead letter addresses and maximum delivery attempts are defined in the configuration file broker.xml:

-
-         <address-setting match="jms.queue.exampleQueue">
-            <dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
-            <max-delivery-attempts>3</max-delivery-attempts>
-         </address-setting>
-         
-     
-

This configuration will moved dead letter messages from exampleQueue to the deadLetterQueue.

-

ActiveMQ Artemis allows to specify either a Queue by prefixing the dead-letter-address with jms.queue. - or a Topic by prefixing with jms.topic..
- In this example, we will use a Queue to hold the dead letter messages.

-

The maximum attempts of delivery is 3. Once this figure is reached, a message is considered a dead letter message and is moved to - the deadLetterQueue. -

Since we want to consume messages from this deadLetterQueue, we also need to add a JNDI binding to perform a lookup. - This is configured in activemq-jms.xml

-
-         <queue name="deadLetterQueue">
-            <entry name="/queue/deadLetterQueue"/>
-         </queue>
-     
- - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java b/examples/jms/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java deleted file mode 100644 index db28568..0000000 --- a/examples/jms/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java +++ /dev/null @@ -1,136 +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; - -/** - * An example showing how messages are moved to dead letter destination when they are unsuccessfully delivered multiple times - */ -public class DeadLetterExample { - - public static void main(final String[] args) throws Exception { - Connection connection = null; - InitialContext initialContext = null; - - try { - // Step 1. Create an initial context to perform the JNDI lookup. - initialContext = new InitialContext(); - - // Step 2. Perfom a lookup on the queue - Queue queue = (Queue) initialContext.lookup("queue/exampleQueue"); - - // Step 3. Perform a lookup on the Connection Factory - ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory"); - - // Step 4.Create a JMS Connection - connection = cf.createConnection(); - - // Step 5. Create a * 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 ready to be redelivered - session.rollback(); - - // Step 14. We receive a message and roll back the session a second time - messageReceived = (TextMessage) messageConsumer.receive(5000); - System.out.println("2nd delivery from " + queue.getQueueName() + ": " + messageReceived.getText()); - session.rollback(); - - // Step 15. We receive a message and roll back the session a third time - messageReceived = (TextMessage) messageConsumer.receive(5000); - System.out.println("3rd delivery from " + queue.getQueueName() + ": " + messageReceived.getText()); - session.rollback(); - - // The message has been delivered unsuccessfully 3 times -> it is moved to the dead letter queue. - - // Step 16. The 4th time, call will timeout after 5000ms and messageReceived will be null - messageReceived = (TextMessage) messageConsumer.receive(5000); - System.out.println("4th delivery from " + queue.getQueueName() + ": " + messageReceived); - - // We will now consume the message from the dead letter queue - - // Step 17. Perform a lookup on the dead letter queue - Queue deadLetterQueue = (Queue) initialContext.lookup("queue/deadLetterQueue"); - - // Step 18. Create a JMS Message Consumer for the dead letter queue - MessageConsumer deadLetterConsumer = session.createConsumer(deadLetterQueue); - - // Step 19. Receive the message from the dead letter queue - messageReceived = (TextMessage) deadLetterConsumer.receive(5000); - - // Step 20. The message sent to the queue was moved to the dead letter queue after 3 unsuccessful deliveries - System.out.println("Received message from " + deadLetterQueue.getQueueName() + - ": " + - messageReceived.getText()); - - // The message received from the dead letter queue has the same content than the undelivered message but its - // JMS headers - // differ (from JMS point of view, it's not the same message). - // ActiveMQ Artemis defines additional properties for messages received from the dead letter queue - - System.out.println(); - // Step 21. the messageReceived's destination is now the dead letter queue. - System.out.println("Destination of the message: " + ((Queue) messageReceived.getJMSDestination()).getQueueName()); - - // Step 22. the *origin* destination is stored in the _AMQ_ORIG_ADDRESS property - System.out.println("*Origin destination* of the message: " + messageReceived.getStringProperty("_AMQ_ORIG_ADDRESS")); - - // Step 23. This time, we commit the session, the delivery from the dead letter queue is successful! - session.commit(); - } - finally { - // Step 24. 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/21bf4406/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/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/21bf4406/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/dead-letter/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/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/21bf4406/examples/jms/dead-letter/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/src/main/resources/activemq/server0/broker.xml b/examples/jms/dead-letter/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index fdf88cc..0000000 --- a/examples/jms/dead-letter/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - ${data.dir:../data}/bindings - - ${data.dir:../data}/journal - - ${data.dir:../data}/largemessages - - ${data.dir:../data}/paging - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - - - jms.queue.deadLetterQueue - 3 - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/dead-letter/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/jms/dead-letter/src/main/resources/jndi.properties b/examples/jms/dead-letter/src/main/resources/jndi.properties deleted file mode 100644 index 3e1a366..0000000 --- a/examples/jms/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/21bf4406/examples/jms/delayed-redelivery/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/pom.xml b/examples/jms/delayed-redelivery/pom.xml deleted file mode 100644 index 2fd5090..0000000 --- a/examples/jms/delayed-redelivery/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.jms - jms-examples - 1.0.1-SNAPSHOT - - - delayed-redelivery - jar - ActiveMQ Artemis JMS Delayed Redelivery Example - - - ${project.basedir}/../../.. - - - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - noServer - - true - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create - - create - - - ${basedir}/target/classes/activemq/server0 - ${noServer} - - - - start - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.DelayedRedeliveryExample - - - - stop - - cli - - - ${noServer} - - stop - - - - - - - org.apache.activemq.examples.jms - delayed-redelivery - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/delayed-redelivery/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/readme.html b/examples/jms/delayed-redelivery/readme.html deleted file mode 100644 index 09ecb38..0000000 --- a/examples/jms/delayed-redelivery/readme.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - ActiveMQ Artemis Delayed Redelivery Example - - - - - -

Delayed Redelivery Example

-
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

This example demonstrates how ActiveMQ Artemis can be configured to provide a delayed redelivery in the case - where a message needs to be redelivered.

-

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.

-

Re-delivery occurs when the session is closed with unacknowledged messages. The unacknowledged messages will - be redelivered.

-

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.

- -

Example setup

-

Redelivery delay is specified in the configuration file broker.xml:

-

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. match="jms.#" would apply the settings - to all JMS queues and topics.

-

We then consume a message in a transacted session, and rollback, and note that the message is not redelivered until - after 5 seconds.

-
-         <address-setting match="jms.queue.exampleQueue">
-            <redelivery-delay>5000</redelivery-delay>
-         </address-setting>
-         
-     
- - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java b/examples/jms/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java deleted file mode 100644 index afa538f..0000000 --- a/examples/jms/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/21bf4406/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-roles.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/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/21bf4406/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/artemis-users.properties deleted file mode 100644 index 4e2d44c..0000000 --- a/examples/jms/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/21bf4406/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml b/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml deleted file mode 100644 index 3e41664..0000000 --- a/examples/jms/delayed-redelivery/src/main/resources/activemq/server0/broker.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - ${data.dir:../data}/bindings - - ${data.dir:../data}/journal - - ${data.dir:../data}/largemessages - - ${data.dir:../data}/paging - - - - tcp://localhost:61616 - - - - - - - - - - - - - - - - - - - - 5000 - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/delayed-redelivery/src/main/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/examples/jms/delayed-redelivery/src/main/resources/jndi.properties b/examples/jms/delayed-redelivery/src/main/resources/jndi.properties deleted file mode 100644 index 93537c4..0000000 --- a/examples/jms/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/21bf4406/examples/jms/divert/pom.xml ---------------------------------------------------------------------- diff --git a/examples/jms/divert/pom.xml b/examples/jms/divert/pom.xml deleted file mode 100644 index 4c912b2..0000000 --- a/examples/jms/divert/pom.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - 4.0.0 - - - org.apache.activemq.examples.jms - jms-examples - 1.0.1-SNAPSHOT - - divert - jar - ActiveMQ Artemis JMS Divert Example - - - ${project.basedir}/../../.. - - - - - org.apache.activemq - artemis-server - ${project.version} - - - org.apache.activemq - artemis-jms-client - ${project.version} - - - - - - - noServer - - true - - - - - - - org.apache.activemq - artemis-maven-plugin - - - create0 - - create - - - ${noServer} - org.apache.activemq.examples.jms:divert:${project.version} - ${basedir}/target/server0 - ${basedir}/target/classes/activemq/server0 - - - - create1 - - create - - - ${noServer} - org.apache.activemq.examples.jms:divert:${project.version} - ${basedir}/target/server1 - ${basedir}/target/classes/activemq/server1 - - - - start0 - - cli - - - ${noServer} - true - tcp://localhost:61616 - - run - - server0 - - - - start1 - - cli - - - ${noServer} - true - ${basedir}/target/server1 - tcp://localhost:61617 - - run - - server1 - - - - runClient - - runClient - - - org.apache.activemq.artemis.jms.example.DivertExample - - - - stop0 - - cli - - - ${noServer} - ${basedir}/target/server0 - - stop - - - - - stop1 - - cli - - - ${noServer} - ${basedir}/target/server1 - - stop - - - - - - - org.apache.activemq.examples.jms - divert - ${project.version} - - - - - - - http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/divert/readme.html ---------------------------------------------------------------------- diff --git a/examples/jms/divert/readme.html b/examples/jms/divert/readme.html deleted file mode 100644 index 62067d6..0000000 --- a/examples/jms/divert/readme.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - ActiveMQ Artemis Divert Example - - - - - -

Divert Example

-
To run the example, simply type mvn verify from this directory, 
or mvn -PnoServer verify if you want to start and create the server manually.
- -

ActiveMQ Artemis diverts allow messages to be transparently "diverted" from one address to another - with just some simple configuration defined on the server side.

-

Diverts can be defined to be exclusive or non-exclusive.

-

With an exclusive divert the message is intercepted and does not get sent to the queues originally - bound to that address - it only gets diverted.

-

With a non-exclusive divert the message continues to go to the queues bound to the address, - but also a copy of the message gets sent to the address specified in the divert. Consequently non-exclusive - diverts can be used to "snoop" on another address

-

Diverts can also be configured to have an optional filter. If specified then only matching messages - will be diverted.

-

Diverts can be configured to apply a Transformer. If specified, all diverted messages will have the - opportunity of being transformed by the Transformer.

-

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 routing table - for messages.

- -

Example step-by-step

-

In this example we will imagine a fictitious company which has two offices; one in London and another in New York.

-

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.

-

There is an unreliable WAN linking the London and New York offices.

-

The company also requires a copy of any order received to be available to be inspected by management.

-

In order to achieve this, we will create a queue orderQueue on the London server in to which orders arrive.

-

We will create a topic, spyTopic on the London server, and there will be two subscribers both in London.

-

We will create a non-exclusive divert on the London server which will siphon off a copy of each order - received to the topic spyTopic.

-

Here's the xml config for that divert, from broker.xml

-
-        
-     <divert name="order-divert">
-         <address>jms.queue.orders</address>
-         <forwarding-address>jms.topic.spyTopic</forwarding-address>
-         <exclusive>false</exclusive>
-      </divert>
-         
-     
-

For the prices we will create a topic on the London server, priceUpdates to which all price updates - are sent. We will create another topic on the New York server newYorkPriceUpdates to which all New York - price updates need to be forwarded.

-

Diverts can only be used to divert messages from one local address to another local address - so we cannot divert directly to an address on another server.

-

Instead we divert to a local store and forward queue they we define in the configuration. This is just a normal queue - that we use for storing messages before forwarding to another node.

-

Here's the configuration for it:

-
-        
-     <queues>
-        <queue name="jms.queue.priceForwarding">
-           <address>jms.queue.priceForwarding</address>
-        </queue>
-     </queues>
-         
-      
-

Here's the configuration for the divert:

-
-        
-     <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>
-	     
-	  
-

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.

-

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.

-

Here is the 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>
-         
-     
- -