-
Notifications
You must be signed in to change notification settings - Fork 121
iLink3 Support
iLink3 is a protocol for binary order entry used by CME. It combines a FIXP session protocol with SBE message encoding. The CME Documentation provides details of the protocol itself and should be considered a reference guide, the rest of this wiki page just explains how Artio can be used with iLink3.
iLink3 is an order entry protocol that Artio supports. Just in the same way that Artio supports different versions of the FIX protocol. That means that Artio will manage the iLink3 session protocol and your application has to handle the business logic side of things for example sending orders and handling execution reports. Using Artio to build an iLink3 application enables you to focus your time on coding business logic and not worry about the low level protocol details.
The currently Artio implementation has been tested with iLink3 UAT system for BrokerTec. Once CME releases AutoCert+ for BrokerTec iLink3 then session level conformance scenarios will be tested as well.
Currently in order to build iLink3 you need to build a custom iLink3 because the Artio open source project doesn't distribute the required ilinkbinary.xml SBE schema. This file can be downloaded from the CME SFTP server and should be placed at the location artio-ilink3-codecs/src/main/resources/uk/co/real_logic/artio/ilink/ilinkbinary.xml
within the Artio project structure. After downloading the XML file you can run the following command to build Artio with iLink3 support enabled:
./gradlew -Dfix.core.iLink3Enabled=true
Your development project that will be connecting to iLink3 then needs to add Artio as a dependency to its project structure by depending upon the Artio jars. Here is an example dependencies section that includes Artio with iLink3 support.
dependencies {
implementation "uk.co.real-logic:artio-codecs:${artioVersion}"
implementation "uk.co.real-logic:artio-ilink3-codecs:${artioVersion}"
implementation "uk.co.real-logic:artio-ilink3-impl:${artioVersion}"
implementation "uk.co.real-logic:artio-core:${artioVersion}"
}
Please refer to Artio's normal documentation and samples for examples of how to setup a FixEngine
and FixLibrary
within your project. These examples assume that you have a connected Library and go from there.
You can also refer to the ILink3SystemTest as an example of how to connect to a system.
// (1) Setup a FixLibrary and Engine that we will refer to later.
final FixLibrary library = ...
// (2) You need to initialise the configuration object with the configuration for the gateway that you
// plan to connect to. Your `handler` object in the example must be an implementation of
// `ILink3SessionHandler` - we will discuss this interface in more detail below.
final ILink3SessionConfiguration sessionConfiguration = ILink3SessionConfiguration.builder()
.host(HOST)
.port(PORT)
.sessionId(SESSION_ID)
.firmId(FIRM_ID)
.userKey(USER_KEY)
.accessKeyId(ACCESS_KEY_ID)
.handler(handler)
.build();
// (3) Now you have the configuration object you can initiate a connection to an iLink3 Gateway.
// This returns an async reply object
final Reply<ILink3Session> reply = library.initiate(sessionConfiguration);
// (4) Await the completion of your reply object. That operation can be interleaved with other
// code on your thread's duty cycle, but you must poll the library object regularly.
while (reply.isExecuting())
{
idleStrategy.idle(library.poll(1));
}
// (5) Check the final state of the Reply object - ie whether it has completed successfully or not.
if (sessionReply.hasCompleted())
{
final ILink3Session session = sessionReply.resultIfPresent();
System.out.println("Connected: " + session);
// (6) Now you can you use your session object.
}
// There maybe an error when connecting
else if (sessionReply.hasErrored())
{
sessionReply.error().printStackTrace();
}
// The connection may time out due to a network error
else if (sessionReply.hasTimedOut())
{
System.err.println("Timed out: " + sessionReply);
}
No Acceptor. Engine never owns sessions, they disconnect on library timeout. Additional slow consumer handling removed. As it's mostly of interest to acceptor based use cases. We just disconnect slow connections.