Page tree
Skip to end of metadata
Go to start of metadata

Overview

This document contains description of the main features of REST Transport Adaptor for FixEdge and common steps required to install REST Transport Adaptor (REST TA) for the FIX Edge.

Concept

FIXEdge REST adaptor is a REST server which handles REST requests with incoming messages in JSON form, converts them to FIX format and sends to the target. Adapter is designed for generic processing of messages, without lock-in to specific message type.

Depending on configuration settings, adaptor can transform incoming message to either FIX XML message of 'n' type, or map JSON fields into FIX tags. Type of resulting message should be defined in tag 35.

JSON format of message might look like follows:

'{"35":"D", "1":"12345", "56":"CITIGROUP", ..........}'

Adaptor supports repeating groups and nested repeating groups.

Requests are sent as HTTP POST requests to following URL: http://<Address>:<ListenPort>/messages

Example of REST request using curl for localhost and listen port 8001:

curl -H "Content-Type: application/json" -X POST -d "{\"35\":\"D\",\"1\":\"USD\",\"386\":[{\"336\":\"ABCD\"}]}" http://localhost:8001/messages

Resulting FIX messages can be optionally validated agains FIX dictionaries defined in engine.properties configuration file.

As result of REST request the adapter should return HTTP status code:

  • 200 - Success
  • 202 - Accepted, returned when message is successfully received and parsed, but couldn't be delivered to client in FE
  • 400 - HTTP error Bad Request (with JSON content including error message), in case of wrong input message or validation errors
  • 404 - HTTP error Not found for requests with wrong URL  

Logging for received and send messages

FIXEdge REST adaptor can be configured to write into separate log file the following data:

  • Content of input request
  • Resulting FIX messages
  • HTTP status returned to the caller

Integration with FIXICC

Adaptor supports monitoring of its current state with FIXICC. It provides the following monitorable properties:

  • number of received messages
  • number of sent messages
  • number of rejected messages

Description of JSON format for input messages:

  • Fields in input JSON message are listed as pairs of "FIXID":"FIXValue".
  • JSON message can contain repeating groups represented as follows:

    { "NoRecordsID": [      { "FIXID":"FIXValue", "FIXID":"FIXValue"... },      { "FIXID":"FIXValue", "FIXID":"FIXValue"... }     ...    ] }

Message Conversion Methods

REST Acceptor TA supports two conversion methods:

  1. WrapInXmlMessage
    1. Adapter accepts any JSON
    2. Adapter creates FIX message 35=n (XML Message)
    3. Adapter stores received JSON as-is in tag 213 (XmlData)
    4. Adapter routes FIX message to BL
  2. NumericTagValueMapping
    1. Adapter accepts JSON, structured as described in JSON format for input messages section
    2. Adapter seeks tag-value pair "35":"XYZ" in incoming JSON
    3. If tag-value pair "35":"XYZ" is not found, or XYZ is not a valid FIX message type, adapter returns an error.
    4. Adapter creates empty FIX message with MsgType 35=XYZ 
    5. For every tag-value pair in JSON corresponding tags/values are filled in FIX message by Adapter
    6. Adapter routes FIX message to BL

FIX Message validation

REST Acceptor TA can be configured to validate converted FIX messages. FIX Message validation uses default validation options:

  • prohibitTagsWithoutValue = true
  • verifyDataTagsSequence = true
  • verifyTagsValues = true
  • prohibitUnknownTags = true
  • prohibitDuplicatedTags = true
  • verifyReperatingGroupBounds = true
  • checkRequiredGroupFields = true
  • allowZeroNumInGroup = false
  • ignoreUnknownFields = false 

Installation steps

 In order to setup REST TA for FIX Edge you need:

1. Copy FIXEdge distribution package to the FIX Edge home:

Unpack the content of distribution package to FIXEdge root directory, e.g. to the C:\FIXEdge.

2. Enable TA to be used by FIX Edge

In the ‘Transport Layer Section’ of the FIXEdge.properties add REST TA to the list of supported adapters:


TransportLayer.TransportAdapters = TransportLayer.RestTA

Note: if you use other transport adapter, just add TransportLayer.RestTA to the end of the list, e.g:


TransportLayer.TransportAdapters = TransportLayer.SmtpTA, TransportLayer.RestTA

3. Configure TA

3.1.   Add REST TA section to the FIXEdge.properties.

Sample set of properties is given below:


TransportLayer.TransportAdapters = TransportLayer.RestTA

TransportLayer.RestTA.Description = REST Acceptor TA
TransportLayer.RestTA.DllName = bin/rest_acceptor_ta-vc10-MD-x64.dll
TransportLayer.RestTA.Type = DLL

TransportLayer.RestTA.ClientID = RestAcceptorClient
TransportLayer.RestTA.LogCategory = RestAcceptorClient
TransportLayer.RestTA.ListenPort = 8001
TransportLayer.RestTA.FIXVersion = FIX50
TransportLayer.RestTA.ConversionMethod = NumericTagValueMapping
TransportLayer.RestTA.ValidateFIXMessage = ValidateAndWarn


Note: sample settings could be copied from RESTAcceptorTA.properties file (in doc folder of FIXEdge distribution package) to FIXEdge.properties file.

3.2.  Optionally configure logging for received and sent messages in a separate log category:


Log.RESTTA.Device = File
Log.RESTTA.DebugIsOn = true
Log.RESTTA.TraceIsOn = true
Log.RESTTA.NoteIsOn = true
Log.RESTTA.File.Name = FIXEdge1/log/RESTTA.log

4.       Restart FIX Edge to apply the changes 

Routing Messages from REST TA

REST TA Client can be referred on the business layer (BL) by ClientID name specified in the FIXEdge.properties file. Below is an example of the BL_Config.xml.

BL_Config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- 
    FIXEdge - the XML Configuration file
    $Revision: 1.17.2.7 $
<!DOCTYPE FIXEdge SYSTEM "BusinessLayer.dtd">
-->
<FIXEdge>
    <BusinessLayer>
        <Rule>
            <Source Name="RestAcceptorClient"/>
            <Condition>
                <MatchField Field="35" Value=" D|G|F|n " />
            </Condition>
            <Action>
                <Send>
                    <FixSession SenderCompID="FIXEDGE" TargetCompID="FIXCLIENT"/>
                </Send>
            </Action>
        </Rule>
 
        <DefaultRule>
            <Action>
                <DoNothing/>
            </Action>
        </DefaultRule>
    </BusinessLayer>
</FIXEdge>


REST TA Configuration Parameters

Configuration of REST Adaptor contains list of adaptor properties, HTTP server properties, and log settings:

 

Property Name

 
 

Description

 
 

Required

 
 

Default Value

 
 

TransportLayer.RestTA.Description

 
 

TA Description

 
 

Y

 
 

REST Acceptor TA

 
 

TransportLayer.RestTA.DllName

 
 

TA library file name

 
 

Y

 
 

 

 
 

TransportLayer.RestTA.Type

 
 

TA library type

 
 

Y

 
 

DLL

 
 

TransportLayer.RestTA.ClientID

 
 

Transport adaptor Client ID which identifies the source of messages in BL config

 
 

Y

 
 

 

 
 

TransportLayer.RestTA.LogCategory

 
 

Transport adaptor log category

 
 

Y

 
 

 

 
 

TransportLayer.RestTA.ListenPort

 
 

TCP port number for incoming HTTP connections. Allowed range is 1 - 65535

 
 

N

 
 

8001

 
 

TransportLayer.RestTA.FIXVersion

 

FIX version of generated messages:

FIX40 - FIX 4.0

FIX41 - FIX 4.1

FIX42 - FIX 4.2

FIX43 - FIX 4.3

FIX44 - FIX 4.4

FIX50 - FIX 5.0

FIX50SP1 - FIX 5.0 SP1

FIX50SP2 - FIX 5.0 SP2

 
 

N

 
 

FIX44

 
 

TransportLayer.RestTA.ConversionMethod

 

Method used to convert input messages into FIX format:

WrapInXmlMessage - put the input data into FIX XML message of 'n' type

NumericTagValueMapping - parse the input JSON file format to corresponding FIX message

 
 

N

 
 

NumericTagValueMapping

 
 

TransportLayer.RestTA.ValidateFIXMessage

 

Enables/disables validation of resulting FIX message:

No – validation disabled

ValidateAndWarn – validation enabled, warning message is added to the log when validation fails

ValidateAndReject – validation enabled, service returns HHTP error 400 (bad request) and rejects the message if validation fails

 
 

N

 
 

No

 

HTTP Server Parameters

 
 

TransportLayer.RestTA.HTTP.timeout

 
 

Connection timeout for HTTP connections in seconds.

 
 

N

 
 

60

 
 

TransportLayer.RestTA.HTTP.keepAlive

 
 

Enables/disables persistent HTTP connections:

false – persistent HTTP connections are disabled true – persistent HTTP connections are enabled

 
 

N

 
 

true

 
 

TransportLayer.RestTA.HTTP.maxKeepAliveRequests

 
 

Specifies the maximum number of requests allowed during a persistent connection. 0 means unlimited connections.

 
 

N

 
 

0

 
 

TransportLayer.RestTA.HTTP.keepAliveTimeout

 
 

Connection timeout for persistent HTTP connections in seconds.

 
 

N

 
 

10

 
 

TransportLayer.RestTA.HTTP.maxThreads

 
 

Maximum number of threads processing HTTP requests. Allowed range is 1 – 16. 

 

N

 
 

1

 

REST TA Log settings

 

 

Log.RESTTA.Device

 

Target device for logging the received and sent messages:

File – writes log to a separate file

Console – sends log to console window

 
 

N

 
 

 

 

 

Log.RESTTA.File.Name

 

 

File name used to log the received and sent messages

 
 

N

 
 

 

 
  • No labels