The RabbitMQ Transport Adaptor (hereinafter the RMQ TA) is intended to communicate FIX messages to other applications using RabbitMQ as middleware. The document describes common steps required to install Transport for the FIX Edge.
RMQ TA Functionality
RMQTA is able to have one or more producers and consumers.
Producer is used to transfer messages from FIXEdge to the configured RabbitMQ server’s queue. Producer connects to the queue immediately or at configured time (see parameter "StartTime") if connection is available and the queue exists.
Consumer listens for the incoming messages from MQ and publishes these messages to the FIXEdge. If heartbeat processing is disabled (see parameter "HeartBeat.Enable"), the consumer connects to the queue immediately or at configured time (refer to parameter "StartTime" for details) when connection is available and the queue exists. Otherwise, consumer connects to the queue when first message (no matter heartbeat or any other message) is received.
RMQ TA supports internal heartbeat processing that allows to determine if counterparties are in the state of inactivity.
The format of Heartbeat message is configurable via "HeartBeat.MessageFile" property. The content of the file is read as byte sequence that is compared with incoming message as is.
Reconnection procedure starts (see parameter "Reconnect") if connection is unavailable or the queue does not exist. Producer attempts to reconnect configured number of tries in the configured time intervals (see parameters "ReconnectTries" and "ReconnectInterval" for details).
Reconnection procedure starts (see parameter "Reconnect") if connection becomes unavailable or no message is received in the configured time interval. Consumer attempts to reconnect configured number of tries in the configured time intervals (see parameters "ReconnectTries" and "ReconnectInterval" for details).
Clients can be grouped via "ClientGroups" property. Grouped clients are available for work if all clients in this group are connected to their queues. In other words, if one client is disconnected – all clients-members of the group will be also in Disconnected state.
Typically it is used for pairs of Producer-Consumer when there is no sense to leave one of the clients in Connected state when another one is disconnected.
RMQ TA Configuration
TA distribution package contains following folders:
- etc – contains the configuration files;
- lib – contains the libraries for working RMQ TA.
In order to setup RMQ TA for FIX Edge you need:
- Copy TA distribution package to the FIX Edge folder
- Copy lib folder from distribution package to the conf directory, e.g. to the FIXGW/FIXEdge1/conf/amqp-ta-distribution.
- Copy log4j.properties and JVM_Options.jvmopts configuration files from the etc to the configuration directory of the FIX Edge, e.g. FIXGW/FIXEdge1/conf.
- Check and correct the paths in the JVM_Options.jvmopts configuration file to the libs and log4j.properties according your workspace.
- Check path to the jvm folder in path environment variable If your operating system is the windows. If your system is unix check the path in FixEdge1.run.sh which located in bin directory of the FIXEdge.
- Configure TA
In the ‘Transport Layer Section’ of the FIXEdge.properties add RMQ TA to the list of supported adapters:
Add RMQ TA section to the FIXEdge.properties which located in conf directory of the FIXEdge.
Sample set of properties is given below:
- Make sure the RabbitMQ’s user, password and queue you use are configured on the server side.
- Change TA logging settings in the log4j.properties if necessary. Paths to logs dir must be absolute.
- Restart FIX Edge to apply the changes.
Routing Messages to/from RMQ TA Clients
RMQ Clients can be referred on the business layer (BL) by their names specified in the FIXEdge.properties file. Below is an example of the BL_Config.xml for the two RMQ clients specified above.
RMQ TA Configuration Parameters
Configuration of RMQ Adaptor contains list of registered RMQ client names and other parameters which takes part in message routing.
In configuration of RMQ TA can be present default parameters:
|Property Name||Description||Required||Default Value|
|TransportLayer.RMQTA.Description||TA Description||Y||RMQ Transport Adaptor|
|TransportLayer.RMQTA.DllName||TA library file name. libUniversalTADll-gcc44-MD-x64.so should be used.||Y|
|TransportLayer.RMQTA.JVMOptionsFile||Path to the TA configuration file name||Y|
|TransportLayer.RMQTA.JavaClass||Java class to be used. com.epam.fe.jms.jni.JMSAdaptor should be used.||Y|
|When option is true, FE rejects messages if unable to send to the MQ or error was fired. False by default.||N||false|
|TransportLayer.RMQTA.AllowRepeatedStatusNotification||When option is true, FE allows to call onLogout() callback if no onLogon() callback was called. False by default.||N||false|
Comma delimited list of TA connections.
|TransportLayer.RMQTA.FIXVersion||In every session, FIX messages use a particular version of the FIX protocol. Use this parameter to set the version of the FIX protocol for a given session.|
FIX40, FIX41, FIX42, FIX43, FIX44, FIX50, FIX50SP1, FIX50SP2.
Comma delimited list of TA clients.
|TransportLayer.RMQTA.ClientGroups||Comma delimited list of clients group.||N|
|TransportLayer.RMQTA.[GroupName].Clients||Comma delimited list of TA clients that are grouped.||N|
URI has the following format: amqp://<host>:<port>/<vhost>
Addresses list. Necessary for clustered solutions to switch between addresses in case of disconnects.
Note, reconnect attempts or intervals are not configurable - when first connection is down, adapter switches to the next connection immediately.
Should be specified one of the parameters - ProviderURI or Addresses.
|TransportLayer.RMQTA.Connection.[ConnectionName].Reconnect||Enables or disables reconnect procedure for connection restore||N||false|
Fixed interval in milliseconds between reconnection attempts.
|TransportLayer.RMQTA.Connection.[ConnectionName].ReconnectTries||Number of reconnect tries or -1 for an infinite number of attempts||N||3|
|TransportLayer.RMQTA.Client.[ClientName].ConnectionName||Name of primary connection used by client. Connection should be registered in ConnectionNames enumeration and has all required parameters||Y|
URI of session destination (Queue name). Required for Consumer session type.
For Producer session type should be specified one of the parameters - DestinationURI or ExchangeName - or both of them.
Name of the Exchange. See RabbitMQ tutorial for details: https://www.rabbitmq.com/tutorials/amqp-concepts.html.
Only for Producer session type. Works with "topic" and "direct" exchange types - on RabbitMQ queues can be bound to an exchange, in this case DestinationURI parameter will be used as routing key.
|TransportLayer.RMQTA.Client.[ClientName].StorageDir||Directory where persistence file is stored in case the communication problem||Y|
|TransportLayer.RMQTA.Client.[ClientName].HeartBeat.Enable||If parameter is true then TA sends and expects HeartBeat messages in configured time interval||N||false|
|TransportLayer.RMQTA.Client.[ClientName].HeartBeat.Interval||Time interval in seconds before sending or expecting incoming HeartBeat message||N||30|
|TransportLayer.RMQTA.Client.[ClientName].HeartBeat.MessageFile||Path to binary file that contains HeartBeat message||Y|
|TransportLayer.RMQTA.Client.[ClientName].HeartBeat.MissedCountBeforeDisconnect||Number of missed messages before disconnect||N||3|
Type of action that TA executes in case it's unable to deliver outgoing messages to the queue:
The property turns on transactions to ensure that the messages are stored on the disk.
Values: true | false
NOTE: This property affects performance.
Client start time.
Client stop time.