- Index

< Previous |  | Next >

# CME MDP3 Adapter

## Introduction

The TIBCO StreamBase® Input Adapter for CME Market Data allows StreamBase to receive data from a CME Market Data Protocol (MDP3) connection.

### Placing a CME MDP3 Adapter on the Canvas

The CME MDP3 adapter is a member of the Java Adapters group in the Palette view in StreamBase Studio. Select the adapter from the Insert an Operator or Adapter dialog, following these steps:

1. Open the Insert an Operator or Adapter dialog with one of the following methods:

   1. Drag the Adapters, Java Operators token from the Operators and Adapters drawer of the Palette view to the canvas.

   2. Click on the canvas where you want to place the adapter, then invoke the keyboard shortcut `A I`.

   3. From the top-level menu, invoke Insert → Input Adapter.

2. In the search field, enter `CME` to narrow the list of adapters.

3. Select the CME MDP3 adapter and click OK.

### Prerequisites

In order run correctly, the adapter requires that the open-source Java Market Data Handler for CME Market Data (MDP 3.0) from EPAM Systems be installed on development and deployment machines that are expected to run StreamBase applications that call this adapter. You can obtain the Data Handler software from GitHub.

Once you download the above zip file, extract its contents to a temporary location and Maven install the following JAR files to your maven repository:

- Install the `b2bits-jmdp3-2.0/b2bits-jmdp3-2.0.jar` file to the local Maven repository with a mvn command like the following:

      mvn install:install-file
        -Dfile=b2bits-jmdp3-2.0/b2bits-jmdp3-2.0.jar
        -DgroupId=com.tibco.ep.sb.thirdparty.com.epam
        -DartifactId=b2bits-jmdp3 -Dversion=2.0.0 -Dpackaging=jar

- Install the `b2bits-jmdp3-2.0/lib/b2bits-jmdp3-core-2.0.jar` file to the local Maven repository with a mvn command like the following:

      mvn install:install-file
        -Dfile=b2bits-jmdp3-2.0/lib/b2bits-jmdp3-core-2.0.jar
        -DgroupId=com.tibco.ep.sb.thirdparty.com.epam
        -DartifactId=b2bits-jmdp3-core -Dversion=2.0.0 -Dpackaging=jar

### How the Adapter Works

The adapter has two input streams, one for commands and the other for instrument subscriptions. The command stream currently takes the CONNECT and DISCONNECT command. The subscription stream is used to SUBSCRIBE or UNSUBSCRIBE to the specified instrument (specified by SecurityID and SecurityDesc) or to UNSUBSCRIBEALL (to remove all subscriptions). Note that subscriptions are not dynamic; any subscription changes do not fully take effect until the connection is cycled (DISCONNECT then CONNECT).

## Adapter Properties

This section describes the properties you can set for the adapter, using the various tabs of the Properties view in StreamBase Studio.

In following section tables, the Property column shows each property name as found in the one or more adapter properties tabs of the Properties view for this adapter.

Use the StreamSQL names of the adapter's properties when using this adapter in a StreamSQL program with the APPLY JAVA statement.

### General Tab

Name: Use this required field to specify or change the component's name, which must be unique in the current module. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Operator: A read-only field that shows the formal name of the operator.

Start with application: If this field is set to Yes (default) or to a module parameter that evaluates to `true`, this instance of this operator starts as part of the JVM engine that runs this EventFlow fragment. If this field is set to No or to a module parameter that evaluates to `false`, the operator instance is loaded with the engine, but does not start until you send an epadmin container resume command (or its sbadmin equivalent), or until you start the component with StreamBase Manager.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

### Adapter Properties

The MDP3 adapter has the following properties:

#### Properties Tab

Property | Data Type | Default | Description | StreamSQL Property
--- | --- | --- | --- | ---
Channel Config File | string | N/A | REQUIRED. Must point to the MDP channel configuration file (typically named `config.xml`), as distributed by CME. See https://www.cmegroup.com/confluence/display/EPICSANDBOX/MDP+3.0+-+FTP+Site+Information | configFile
Message Templates File | string | N/A | REQUIRED. Must point to the MDP template file (typically named `templates_FixBinary.xml`), as distributed by CME. See https://www.cmegroup.com/confluence/display/EPICSANDBOX/MDP+3.0+-+FTP+Site+Information | templateFile
Channel ID | integer | N/A | REQUIRED. Number of the channel to which to connect (to connect to multiple channels, use separate instances of the adapter). | channelID
Market Data Type | radio buttons | Market By Order | Whether to use Market By Price or Market By Order. | mdtype
Subscribe To All Instruments | check box | unchecked (false) | Whether to subscribe to all instruments available on the channel, or to subscribe to individual instruments via either a subscription file or the subscription input port, or both. | subscribeToAll
Subscription File | string | blank | If Subscribe To All Instruments is unchecked, a CSV file containing the list of initial subscriptions may be specified. The format of this file is as follows: `# This is a comment` `# SecurityID,SecurityDesc` `123456,MyInstrument` `654321,MyOtherInstrument` | subscriptionFile
Connect At Startup | check box | unchecked (false) | Whether to attempt to connect to the data feed when the application is launched. | connectOnStartup
Gap Threshold | integer | 0 | Number of out-of-sequence messages beyond which a replay is issued (0 to use default value). | gapThreshold
Incremental Queue Size | integer | 0 | Size of the message queue on incremental feeds (0 to use default). | incrFeedQ
Receive Buffer Size | integer | 0 | Size of the receive buffer (0 to use default). | rcvBuf
Network Interface Name (Feed A) | string | blank | Name of the Network Interface Card to use to establish connections to the A feed (leave blank to use default). | feedAInterface
Network Interface Name (Feed B) | string | blank | Name of the Network Interface Card to use to establish connections to the B feed (leave blank to use default). | feedBInterface
User Name | string | blank | User name to use when logging on to the TCP Replay feed (leave blank to use default). | userName
Password | string | blank | Password to use when logging on to the TCP Replay feed (leave blank to use default). | password
Log Level | drop-down list | INFO | Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level will be used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE. | LogLevel

### Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

### Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

## Input Ports

The adapter has two input ports — the command and subscription ports.

Use the command port to programmatically trigger a connection or disconnection.

Field Name | Field Type | Description
--- | --- | ---
Command | string | The command to execute: `Connect` or `Disconnect`.

Use the subscription port to programmatically add or remove subscriptions of instruments on the channel.

Field Name | Field Type | Description
--- | --- | ---
Command | string | The command to execute: `Subscribe` or `Unsubscribe` or `UnsubscribeAll`.
SecurityID | string | The ID number (SecurityID tag) of the instrument to which to subscribe or unsubscribe. Ignored for the `UnsubscribeAll` command.
SecurityDesc | string | The description (SecurityDesc tag) of the instrument to which to subscribe. Ignored for the `Unsubscribe` and `UnsubscribeAll` commands.

## Output Ports

The adapter has several output ports:

- Status: Emits tuples related to status events (successful operations, errors, etc)

- Full Snapshot: Market Data Full Snapshot messages

- Incremental Refresh: Market Data Incremental Refresh messages

- RFQ: RequestForQuote messages

- Security Status: SecurityStatus messages

- Security Definition: SecurityDefinition messages

The schema for the Status port is described below, while the schema for the other ports simply contain every field in the received message. Null fields indicate that the corresponding field was not specified in the message. Repeating groups are represented as a list of tuples, where each tuple represents one group.

### Status Output Port

The status port emits tuples that describe events of interest, such as errors or the result of executing a command.

Field Name | Field Type | Description
--- | --- | ---
status | string | Describes this event. Possible values can include `Connected`, `Disconnected`, `Error`, and others.
info | list<string> | Contains any additional information pertaining to this event.

## Typechecking and Error Handling

Typechecking fails if the input schema does not contain all the required fields.

## Suspend and Resume Behavior

Upon suspension, the adapter finishes processing any message in flight, outputs the result tuples, then pauses until operation is resumed. Any messages received while paused are dropped.

Upon resumption, the adapter continues processing new messages as they are received.

## CME MDP3 Adapter Sample

The StreamBase installation includes a sample demonstrating the use of this adapter. To load the sample in StreamBase, select File → Load StreamBase Sample and type `cme` to narrow the possible choices. Select the entry called CME MDP3 Adapter.

Back to Top ^

## Related Topics

- CME MDP3 adapter sample

- Using Embedded Adapters

Back to Top ^