| <?xml version="1.0" encoding="ISO-8859-1" ?> |
| <!-- |
| ~ 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. |
| --> |
| |
| <document> |
| <properties> |
| <title>Apache Synapse - Sample 700</title> |
| </properties> |
| <body> |
| <section name="Sample 700: Introduction to Synapse Message Stores"> |
| <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> |
| <!--Simple in Memory Message Store with name foo --> |
| <messageStore name="foo" sequence="bar"> |
| <redelivery> |
| <!--retry interval 1 sec --> |
| <interval>1</interval> |
| <!--Message will be stored after 2 redeliveries --> |
| <maximumRedeliveries>2</maximumRedeliveries> |
| <exponentialBackoff>true</exponentialBackoff> |
| <backoffMutiplier>2</backoffMutiplier> |
| </redelivery> |
| </messageStore> |
| |
| <!-- filtering of messages with XPath and regex matches --> |
| <filter source="get-property('To')" regex=".*/StockQuote.*"> |
| <send> |
| <endpoint key="SampleEndpoint"/> |
| </send> |
| <drop/> |
| </filter> |
| <send/> |
| <!-- Endpoint named SampleEndpoint--> |
| <endpoint name="SampleEndpoint" onFault="foo"> |
| <address uri="http://localhost:9000/services/SimpleStockQuoteService"> |
| <suspendDurationOnFailure>2</suspendDurationOnFailure> |
| </address> |
| </endpoint> |
| |
| <sequence name="bar"> |
| <log level="full"/> |
| </sequence> |
| </definitions></div> |
| <subsection name="Objective"> |
| <p> |
| Demonstrate the usage of Synapse message stores and how to use a message store |
| to implement the popular 'Dead Letter Channel' integration pattern |
| </p> |
| </subsection> |
| <subsection name="Pre-requisites"> |
| <p> |
| <ul> |
| <li> |
| Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 |
| </li> |
| <li> |
| Start Synapse using the configuration numbered 700 (repository/conf/sample/synapse_sample_700.xml) |
| <div class="command"> |
| Unix/Linux: sh synapse.sh -sample 700<br/> |
| Windows: synapse.bat -sample 700 |
| </div> |
| </li> |
| </ul> |
| </p> |
| </subsection> |
| <subsection name="Executing the Client"> |
| <p> |
| First execute the sample client as follows. |
| </p> |
| <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/soap/StockQuote</div> |
| <p> |
| Since you have the sample Axis2 server running, you will get a stock quote response |
| at the client side. Axis2 server will also print a log confirming the generation |
| of a new quote value. Now shut the Axis2 server down and invoke the sample client |
| again. Now Synapse will attempt twice to deliever the message and faling that, the |
| message will be stored in the specified in-memory message store (dead letter channel) |
| for later delivery. |
| </p> |
| <p> |
| Now you can use the JMX view of the Synapse message store to see the message |
| stored in the dead letter channel and manually retry on them. |
| </p> |
| </subsection> |
| </section> |
| <p><a href="../samples.html">Back to Catalog</a></p> |
| </body> |
| </document> |