This blog post describes the message flow of ESB at the synapse level from the client to backend and then backend to client.
To trace the message flow we can deploy a proxy service and invoke that,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="https,http">
<target>
<inSequence>
<log/>
<send>
<endpoint>
<address uri="http://www.mocky.io/v2/5924085b100000771e003629"/>
</endpoint>
</send>
</inSequence>
</target>
<description/>
</proxy>
When a request comes from the client side, at the synapse level, it first hits the receive method in ProxyServiceMessageReceiver. This is the message flow in the request flow,
In-Flow
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive
at this level having the axis2 message context
org.apache.synapse.core.axis2.MessageContextCreatorForAxis2.getSynapseMessageContext
get the synapse message context out of it
org.apache.synapse.core.axis2.ProxyService.registerFaultHandler
fault handler is registered for the proxy service
org.apache.synapse.mediators.base.SequenceMediator.mediate
call the mediate method in the in-sequence
org.apache.synapse.mediator.AbstractListMediator.mediate
iterates through mediators in the in-sequence
org.apache.synapse.mediators.builtin.SendMediator.mediate
org.apache.synapse.endpoints.AddressEndpoint.send
org.apache.synapse.core.axis2.Axis2Sender.sendOn
org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send
Out-Flow
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage
org.apache.synapse.mediators.base.SequenceMediator.mediate()
call the mediate method in the out-sequence
org.apache.synapse.mediators.AbstractListMediator.mediate()
iterates through mediators in the out-sequence
org.apache.synapse.mediators.builtin.SendMediator.mediate()
org.apache.synapse.core.axis2.Axis2Sender.sendBack