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 WSO2 Integration Studio.
- Create an ESB Solution project
- Create the
stockquote
sequence and thesimple
endpoint as local entries with the configurations given above. - Also, create the proxy service named
MainProxy
with the configuration given above. - Deploy the artifacts in your Micro Integrator.
Set up the back-end service:
- Download the stockquote_service.jar.
-
Open a terminal, navigate to the location of the downloaded service, and run it using the following command:
java -jar stockquote_service.jar
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