Sequences and Endpoints as Local Registry Entries¶
This sample demonstrates how sequences and endpoints can be fetched from a local registry.
Synapse configurations¶
Following are the integration artifacts that we can used to implement this scenario. See the instructions on how to build and run this example.
<proxy name="MainProxy" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property name="direction" scope="default" type="STRING" value="incoming"/>
<sequence key="stockquote"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
<sequence name="stockquote" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<!-- log the message using the custom log level. illustrates custom properties for log -->
<log level="custom">
<property name="Text" value="Sending quote request"/>
<property expression="get-property('direction')" name="direction"/>
</log>
<!-- send message to real endpoint referenced by key "simple" endpoint definition -->
<send>
<endpoint key="simple"/>
</send>
</sequence>
<endpoint name="simple" xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
Build and run¶
Create the artifacts:
- Set up ESB Integration Studio.
- Create an integration project with an ESB Configs module and an Composite Exporter.
- Create sequence
stockquote
and endpointsimple
as local entries with the configurations given above. - Also, create the proxy service
MainProxy
with the configuration given above. - Deploy the artifacts in your Micro Integrator.
Set up the back-end service:
- Download the back-end service.
- Extract the downloaded zip file.
- Open a terminal, navigate to the
axis2Server/bin/
directory inside the extracted folder. -
Execute the following command to start the axis2server with the SimpleStockQuote back-end service:
sh axis2server.sh
axis2server.bat
Send a message to invoke the service and analyze the mediation log on the Micro Integrator's start-up console.
You will see that the sequence and the endpoint are fetched from the local entry and that the property named direction
(which was set by the proxy service) is logged by the sequence.
INFO {org.apache.synapse.mediators.builtin.LogMediator} - Text = Sending quote request, direction = incoming