This post explains the message flow of the synapse which is the main building block of WSO2 ESB.
Synapse receives the message from the axis2 transport layer. Inside this transport layer, message will be built based on the content type of the message and then passed over to the Synapse.
Following is the Inflow of the message from the entry point to synapse,
Inside the Axis2FlexibleMEPClient.send() method, a callback is registered in axis2 transport layer and message is dispatched out of the synapse. Then the axis2 transport layer format this message based on the content type and send it to the backend.
When the response is coming from a backend service, transport layer identifies this and synapse response path is invoked.
Following is the synapse response path,
This completes the message flow for the following proxy service configuration.
Synapse receives the message from the axis2 transport layer. Inside this transport layer, message will be built based on the content type of the message and then passed over to the Synapse.
Following is the Inflow of the message from the entry point to synapse,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Entry point | |
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive() | |
//Create synapse message context out of axis2 message context | |
org.apache.synapse.core.axis2.MessageContextCreatorForAxis2.getSynapseMessageContext() | |
//If there is insequence, sequence mediator is invoked | |
org.apache.synapse.mediators.base.SequenceMediator.mediate() | |
//Then registered mediators are executed in order via AbstractListMediator | |
org.apache.synapse.mediators.AbstractListMediator.mediate() | |
//When there is an invoke to a backend service | |
org.apache.synapse.endpoints.AbstractEndpoint.send() | |
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send() | |
org.apache.synapse.core.axis2.Axis2Sender.sendOn() | |
org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send() |
Inside the Axis2FlexibleMEPClient.send() method, a callback is registered in axis2 transport layer and message is dispatched out of the synapse. Then the axis2 transport layer format this message based on the content type and send it to the backend.
When the response is coming from a backend service, transport layer identifies this and synapse response path is invoked.
Following is the synapse response path,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Entry point for response path | |
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive() | |
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage() | |
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage() | |
//invoke the outsequence | |
org.apache.synapse.mediators.base.SequenceMediator.mediate() | |
//invoke the mediators in order | |
org.apache.synapse.mediators.AbstractListMediator.mediate() | |
//send mediator | |
org.apache.synapse.mediators.builtin.SendMediator.mediate() | |
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send() | |
//send back the response | |
org.apache.synapse.core.axis2.Axis2Sender.sendBack() |
This completes the message flow for the following proxy service configuration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<proxy xmlns="http://ws.apache.org/ns/synapse" | |
name="TestProxy" | |
startOnLoad="true" | |
statistics="disable" | |
trace="disable" | |
transports="http,https"> | |
<target> | |
<inSequence> | |
<send> | |
<endpoint> | |
<address uri="http://www.mocky.io/v2/5923c7571000006a1700352a"/> | |
</endpoint> | |
</send> | |
</inSequence> | |
<outSequence> | |
<send/> | |
</outSequence> | |
</target> | |
<description/> | |
</proxy> |
No comments:
Post a Comment