Skip to content

Store Mediator

The Store mediator enqueues messages passing through its mediation sequence in a given message store. It can serve as a dead letter channel if it is included in a fault sequence and if its message store is connected to a message processor that forwards all the messages in the store to an endpoint.

Syntax

<store messageStore="string|expression" sequence="string"/>

Configuration

The parameters available to configure the Store mediator are as follows.

Parameter Name Description
Message Store

The Message Store, in which messages will be stored. You can give the name of the Message Store either as a value or as an expressions.

You have to create the message store before adding it here.

  • To give the Message Store name as a value, add the value for Message Store field.
  • To give the Message Store name as an expressions, click on Ex, and enter the expressions to derive the Message Store.

  • For example: <store messagestore="{//m:msgstr/m:arg/m:value}" xmlns:m="http://services.samples/xsd" sequence="storeSequence"/>

On Store Sequence The sequence that will be called before the message gets stored. This sequence should be created before adding it here.

Examples

Following are examples demonstrating the usage of the Store mediator.

Define the Message Store as a value

An API can be configured with the Store mediator as follows to save messages in a message store named JMSMS.

<api context="/store" name="StoreAPI" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" uri-template="/">
        <inSequence>
             <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="STRING"></property>
             <property name="OUT_ONLY" value="true" scope="default" type="STRING"></property>
             <store messageStore="JMSMS"></store>
        </inSequence>
        <faultSequence>
        </faultSequence>
    </resource>
</api>

Define the Message Store as an XPath expression

An API can be configured with the Store mediator as follows to save messages in a message store, which is extracted dynamically using an XPath expression.

<?xml version="1.0" encoding="UTF-8"?>
<api context="/store" name="StoreAPI" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" uri-template="/">
        <inSequence>
            <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="STRING"></property>
            <property name="OUT_ONLY" value="true" scope="default" type="STRING"></property>
            <store messageStore="{//ser:getQuote/ser:request/ser:symbol}" xmlns:ser="http://services.samples"/>
        </inSequence>
        <faultSequence>
        </faultSequence>
    </resource>
</api>