blob: 423ecbefd4dd13d927b90c4ddc02a9e785a91544 [file] [log] [blame]
<?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">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
&lt;!--Simple in Memory Message Store with name foo --&gt;
&lt;messageStore name="foo" sequence="bar"&gt;
&lt;redelivery&gt;
&lt;!--retry interval 1 sec --&gt;
&lt;interval&gt;1&lt;/interval&gt;
&lt;!--Message will be stored after 2 redeliveries --&gt;
&lt;maximumRedeliveries&gt;2&lt;/maximumRedeliveries&gt;
&lt;exponentialBackoff&gt;true&lt;/exponentialBackoff&gt;
&lt;backoffMutiplier&gt;2&lt;/backoffMutiplier&gt;
&lt;/redelivery&gt;
&lt;/messageStore&gt;
&lt;!-- filtering of messages with XPath and regex matches --&gt;
&lt;filter source="get-property('To')" regex=".*/StockQuote.*"&gt;
&lt;send&gt;
&lt;endpoint key="SampleEndpoint"/&gt;
&lt;/send&gt;
&lt;drop/&gt;
&lt;/filter&gt;
&lt;send/&gt;
&lt;!-- Endpoint named SampleEndpoint--&gt;
&lt;endpoint name="SampleEndpoint" onFault="foo"&gt;
&lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"&gt;
&lt;suspendDurationOnFailure&gt;2&lt;/suspendDurationOnFailure&gt;
&lt;/address&gt;
&lt;/endpoint&gt;
&lt;sequence name="bar"&gt;
&lt;log level="full"/&gt;
&lt;/sequence&gt;
&lt;/definitions&gt;</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>