[WSO2 ESB] How to use the call mediator?

In this post I will briefly explain what we can achieve with a call mediator.

By definition, the call mediator basically calls an external endpoint and then passes the message to the next mediator we have after the call mediator. This means we cannot use the call mediator by its own within the proxy. It always has to work with another mediator.

In example below, we have used a call mediator to invoke a back-end and then pass it to the out sequence, within the outSequence we use respond mediator to send the response back to the endpoint.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="status1"
transports="http,https"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<call>
<endpoint>
<address uri="http://www.mocky.io/v2/577c7fab10000013254c232f"/>
</endpoint>
</call>
<log level="custom">
<property name="message:" value=" Returned from callout"/>
<property name="status:" expression="get-property('axis2','HTTP_SC')"/>
<property name="status:" expression="$axis2:HTTP_SC"/>
</log>
<loopback/>
</inSequence>
<outSequence>
<log level="custom">
<property name="MESSAGE"
value="+++++++++++++++++++++++++++++++++++++++++++++++++++++++ Hit Out Sequence +++++++++++++++++++++++++++++++++++++++++++"/>
</log>
<respond/>
</outSequence>
</target>
<description/>
</proxy>

Hope this helped you to understand the basic idea behind the call mediator.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.