Onix Solutions Logo

OnixS Java CME Drop Copy Handler — Programmer's Guide

Version 4.0.0

TOC

Introduction

Onix Solutions CME Drop Copy Handler for Java is a Java library that provides an access to the CME Group Drop Copy services using FIX Protocol.

High-level Java API allows to build applications rapidly to get drop copy data without much involving into raw protocol specifics.

CME Drop Copy Handler implementations features include:

Note
It's highly recommended to read the "Drop Copy Service" to get familiar with core aspects of CME Drop Copy Service.
By reading this Guide, we also recommend to review a source code of the sample project which comes as a part of the library distributive package.

System Requirements

Getting Started

All Handler classes are encapsulated into the biz.onixs.cme.dropcopy.handler package.

The typical way of using the Handler is as follows:

Migration Guide

In versions prior to DropCopy 4.0 there is Application Message Resend logic which was used to request missed mesages. From version 4.0 CME removed this functionality, so only FIX resend can be used to receive corresponding FIX messages. FIX resend is done automatically by OnixS FIX Engine. For more information please see Resending Messages.

Connecting to Multiple Segments

Handler instance allows to connect to single segment only. To connect to multiple segments, there is need to create one handler instance for each segment. Please see miltisegment sample from installation package.

Note
Segment id is specified as session TargetSubID. SenderCompId and SenderSubId will be same for all segments.
The following example demonstrates how to how to connect to multiple segments.
public class Sample {
    private void run() throws Exception {
        Handler handler1 = new Handler(senderCompId, targetCompId, senderSubId, targetSubId1, senderLocationId);

        handler1.setErrorListener(this);
        handler1.setWarningListener(this);
        handler1.setHandlerListener(this);

        handler1.logon(host1, port1, password);

        // Same SenderCompId and SenderSubId, but different TargetSubID
        Handler handler2 = new Handler(senderCompId, targetCompId, senderSubId, targetSubId2, senderLocationId);

        handler2.setErrorListener(this);
        handler2.setWarningListener(this);
        handler2.setHandlerListener(this);

        handler2.logon(host2, port2, password);
    }
}

Connecting to Backup Sessions

If connection to primary host has been dropped, CME allows to connect to backup host:

Handler supports connection to backup host via providing new host ip address.

The following example demonstrates how to how to switch to backup host.
public class Sample {
    private void run() throws Exception {
        Handler handler = new Handler(senderCompId, targetCompId, senderSubId, targetSubId, senderLocationId);

        handler.setErrorListener(this);
        handler.setWarningListener(this);
        handler.setHandlerListener(this);

        handler.logon(primary_host, port, password);

        // Some network or gateway failure occurs, so there is need to switch to backup host
        handler.logon(backup_host, port, password);
    }
}

Controlling Handler Logging

Controlling Logging in the Handler

By default, Handler logs all important aspects of its activity while processing market data. The SLF4J (Simple Logging Facade for Java) is used by Handler internally. The SLF4J detects and uses the concrete logging implementation configured by user. By default, the Logback logging implementation is recommended.

The Logback (or any other logging implementation) must be configured at the beginning of the application. The examples of Logback configuration can be found in the Handler samples. The details of Logback configuration can be found here.

By default logging is configured to log only errors and warnings. This is an example of logback.xml where detailed logging was switched on:
<logger name="biz.onixs.cme.stp.handler.sample" level="DEBUG"/>
<logger name="biz.onixs.cme.stp.handler" level="INFO"/>
<logger name="biz.onixs.cme.stp.handler.Session.Messages" level="INFO"/>


© Onix Solutions