FIX Setup Guide

This document explains how to setup the FIX transport sender and listener in Synapse as required by the samples. Further it describes how to setup the sample FIX applications (Executor and Banzai) which are essential for trying out the FIX samples.

Introduction

FIX (Financial Information eXchange) is a domain specific communication protocol widely used in the finance sector for securities transactions. The protocol specification spans across the application layer and the session layer of the OSI reference model of networking. Apache Synapse comes with a FIX transport adapter which enables the Synapse ESB to communicate with FIX acceptors and initiators. This allows users to seamlessly integrate FIX applications together and even link FIX applications with other systems that use different protocols.

This article describes how to enable and configure the FIX transport listener and sender for Apache Synapse. It also describes how to setup various sample FIX applications required to try out the FIX protocol related examples.

Prerequisites

The FIX transport adapter of Synapse is built on top of the Quickfix/J open source FIX engine. Therefore the users must deploy the Quickfix/J libraries into Synapse before using the FIX transport. Also in order to try out the FIX samples described in this documentation, it is required to have the 2 sample FIX applications (Banzai and Executor) that come bundled with Quickfix/J. Therefore as the first step download the latest binary distribution of Quickfix/J and extract the downloaded archive to a suitable location on the local disk (let's refer to this location as QFJ_HOME).

All the necessary Quickfix/J libraries are available in the Quickfix/J binary distribution. You have to copy the following jar files from Quickfix/J installation to the 'lib' directory of Synapse.

  • quickfixj-core.jar
  • quickfixj-msg-fix40.jar
  • quickfixj-msg-fix41.jar
  • quickfixj-msg-fix42.jar
  • quickfixj-msg-fix43.jar
  • quickfixj-msg-fix44.jar
  • mina-core.jar
  • slf4j-api.jar

The last 2 jar files can be found in the QFJ_HOME/bin directory and all other files should be available in the QFJ_HOME itself.

Enabling FIX Transport in Synapse

FIX transport listener and the FIX transport sender of Synapse can be enabled by uncommenting the following sections in the repository/conf/axis2.xml file.

<transportReceiver name="fix" class="org.apache.synapse.transport.fix.FIXTransportListener"/>
<transportSender name="fix" class="org.apache.synapse.transport.fix.FIXTransportSender"/>

This will initialize the FIX transport adapter and have it up and running to be used by the proxy services. However some additional setting should be applied at the service level before a service can make use of the FIX transport.

Configuring Services for FIX Transport

When a service needs to be exposed over the FIX transport, we should add the following parameter to the service configuration.

<parameter name="transport.fix.AcceptorConfigURL">url</parameter>

The value of this parameter must be a valid URL which points to a Quickfix/J session configuration file. All the FIX sample configurations are already equipped with this parameter and they are pointing to the sample Quickfix/J configuration files that comes with Synapse. These files can be found in the repository/sample/resources/fix directory. One such configuration file (fix-synapse.cfg) is shown below.

[default] FileStorePath=repository/fix/store/acceptor ConnectionType=acceptor StartTime=00:00:00 EndTime=00:00:00 HeartBtInt=30 ValidOrderTypes=1,2,F SenderCompID=EXEC TargetCompID=SYNAPSE UseDataDictionary=Y DefaultMarketPrice=12.30 [session] BeginString=FIX.4.0 SocketAcceptPort=9876

One of the most important parameters in this configuration is the SocketAcceptPort setting. This defines the port used by the Synapse proxy service to receive incoming FIX messages.

As far as the FIX samples are considered you don't have to make any changes to these Quickfix/J configuration files or the Synapse sample configurations. Default settings should work out of the box without any issues. However some samples may require you to make minor changes to these files.

Setting Up the Sample FIX Applications

Two sample FIX applications are available in the Quickfix/J binray distribution which can be used to send and receive FIX messages. By default these applications are configured to directly communicate with each other. So we should make a few modifications to the configuration to get them to communicate with Synapse. The binaries of these sample programs are available in the quickfixj-examples.jar file in QFJ_HOME. Startup scripts needed to run them can be found in the QFJ_HOME/bin directory.

Configuring the Executor

Executor is the sample acceptor program. To configure this application to receive messages from Synapse, put the following entries to a file named 'executor.cfg'.

[default] FileStorePath=examples/target/data/executor ConnectionType=acceptor StartTime=00:00:00 EndTime=00:00:00 HeartBtInt=30 ValidOrderTypes=1,2,F SenderCompID=EXEC TargetCompID=SYNAPSE UseDataDictionary=Y DefaultMarketPrice=12.30 [session] BeginString=FIX.4.0 SocketAcceptPort=19876

Note that TargetCompID parameter has been set to 'SYNAPSE' and the port number has been set to 9876. You can launch the Executor using the above configuration as follows.

Unix/Linux: sh executor.sh <path to executor.cfg>
Windows: executor.bat <path to executor.cfg>

For some samples you will have to make some minor modifications to this configuration file.

Configuring Banzai

Banzai is a sample FIX initiator that comes with Quickfix/J. This can be used to send FIX messages to a defined FIX acceptor. In case of samples, Synapse will act as the acceptor. In order to send messages to Synapse, we should start Banzai using the following configuration.

[default] FileStorePath=examples/target/data/banzai ConnectionType=initiator SenderCompID=BANZAI TargetCompID=SYNAPSE SocketConnectHost=localhost StartTime=00:00:00 EndTime=00:00:00 HeartBtInt=30 ReconnectInterval=5 [session] BeginString=FIX.4.0 SocketConnectPort=9876

Note that TargetCompID has been set to 'SYNAPSE' and the socket connect port is specified to be 9876, which is the port used by Synapse. To start Banzai with this configuration, save the above in a file named 'banzai.cfg' and launch the sample application as follows.

Unix/Linux: sh banzai.sh <path to banzai.cfg>
Windows: banzai.bat <path to banzai.cfg>