This sample demonstrates how you can use WSO2 ESB to accept FIX input via the FIX transport layer and dispatch to another FIX acceptor that accept messages in a different FIX version. Here you will see how the ESB receives a FIX 4.0 messages and simply forwards it to the FIX 4.1 endpoint.
- For a list of general prerequisites, see Prerequisites to Start the ESB Samples.
- To configure the ESB to use the FIX transport, see Configure the ESB to use the FIX transport.
- You will need the two sample FIX applications (Banzai and Executor) that are provided with Quickfix/J. Configure the two applications to establish sessions with the ESB.
Add the following line to the
FIX40-synapse.xmlfile can be found in the
<ESB_HOME>/repository/samples/resources/fixdirectory. This is a custom FIX data dictionary file that adds the tag 150 and 151 to the execution message(35=8) of FIX4.0. Make sure the
DataDictionaryproperty in the
banzai.cfgfile points to this data dictionary file.
Add the following lines to
executor.cfg, which is the Executor configuration file:
[session] BeginString=FIX.4.1 SocketAcceptPort=19877
- Start Banzai and Executor using the custom configuration files.
- You need to use two custom configuration files for the ESB in this sample. The two custom configuration files can be found in the <
ESB_HOME>/repository/samples/resources/fixdirectory. The two files are
synapse-sender-m.cfg. You need to point your ESB configuration to these two files (this is already done in the provided
synapse_sample_261.xmlfile) or you should create copies of them and point the ESB configuration to the copies. In either case, make sure that the properties
FileLogPathin the two files point to valid locations in your local file system.
Open the <
ESB_HOME>/repository/samples/synapse_sample_261.xmlfile and make sure that the
transport.fix.AcceptorConfigURLproperty points to the
fix-synapse-m40.cfgfile and the
transport.fix.InitiatorConfigURLproperty points to the
The ESB creates a new FIX session with Banzai at this point.
Building the sample
The XML configuration for this sample is as follows:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="OrderProcesserProxy41" transports="fix"> <target> <endpoint> <address uri="fix://localhost:19877?BeginString=FIX.4.1&SenderCompID=SYNAPSE&TargetCompID=EXEC"/> </endpoint> <inSequence> <log level="full"/> </inSequence> <outSequence> <log level="full"/> <send/> </outSequence> </target> <parameter name="transport.fix.AcceptorConfigURL">file:repository/samples/resources/fix/fix-synapse-m40.cfg</parameter> <parameter name="transport.fix.AcceptorMessageStore">file</parameter> <parameter name="transport.fix.InitiatorConfigURL">file:repository/samples/resources/fix/synapse-sender-m.cfg</parameter> <parameter name="transport.fix.InitiatorMessageStore">file</parameter> </proxy> </definitions>
This configuration file
synapse_sample_261.xml is available in the
To build the sample
Start the ESB with the sample 261 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Executing the sample
Send an order request from Banzai to the ESB. For example, Buy DELL 1000 @ MKT.
Analyzing the output
You will see that the ESB forwards the FIX4.0 order request to the Executor that accepts FIX4.1 messages, and that the Executor processes the request and sends a response back to Banzai.