Skip to content

Routing Messages to a Static List of Recipients

This example demonstrates how messages can be routed to a list of static endpoints. This configuration routes a cloned copy of a message to each recipient defined within the static recipient list. The Micro Integrator will create cloned copies of the message and route to the three endpoints mentioned in the configuration. The back-end service prints the details of the placed order.

Synapse configuration

Following is a sample proxy service configuration and mediation sequence that we can used to implement this scenario.

<proxy name="RecipientListProxy" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
   <target>
        <inSequence>
            <header name="Action" value="urn:placeOrder"/>
            <call>
                <endpoint>
                    <!--List of Recipients (static)-->
                    <recipientlist>
                        <endpoint>
                            <address uri="http://localhost:9001/services/SimpleStockQuoteService"/>
                        </endpoint>
                        <endpoint>
                            <address uri="http://localhost:9002/services/SimpleStockQuoteService"/>
                        </endpoint>
                        <endpoint>
                            <address uri="http://localhost:9003/services/SimpleStockQuoteService"/>
                        </endpoint>
                    </recipientlist>
                </endpoint>
            </call>
            <respond/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence>
            <sequence key="errorHandler"/>
        </faultSequence
    </target>
</proxy>
<sequence name="errorHandler">
    <makefault response="true">
        <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
        <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/>
    </makefault>
    <send/>
</sequence>
Top