OnixS C++ CME iLink 3 Binary Order Entry Handler  1.12.0
API Documentation
Tag-based Messaging

To provide a uniform technique to deal with SBE messages, the SDK exposes the Tag-based Messaging subsystem. This subsystem represents an additional "stabilization" layer between the SBE messages and user code. It allows users to achieve tolerance to changes in the SBE Schema by proving the tag-based access to message fields.

Warning
The Tag-based Messaging subsystem should not be used on the time-critical path because it does not provide the fastest way to access the data.

The subsystem classes are located in the OnixS::CME::iLink3::Messaging::TagBased namespace.

Constructing Tag-based Messages

Every Tag-based message contains a constructor that accepts an SBE message:

using namespace OnixS::CME::iLink3;
struct MessageListener
: public SessionListener
{
void onEstablishmentAck(
ONIXS_ILINK3_OVERRIDE
{
const TagBased::Message& fixMessage =
std::cout << fixMessage.type();
}
};

A Tag-based message can be created using OnixS::CME::iLink3::Messaging::MessageHolder and used just like a standard SBE message:

Tag-based messages can also be used with the OnixS::CME::iLink3::Testing::Gateway facilities:

using namespace OnixS::CME::iLink3;
std::unique_ptr<Testing::Gateway> gateway;
// ... accept session
const auto order =
report->
set(
.set(TagBased::Tags::ExecId, executionId)
//...
;
gateway->send(report);

Listening to Tag-based Messages

The OnixS::CME::iLink3::TagBasedSessionListener class allows to subscribe to message related notifications and obtain incoming messages wrapped into Tag-based containers:

using namespace OnixS::CME::iLink3;
struct MyTagBasedSessionListener
{
void onMessage(
ONIXS_ILINK3_OVERRIDE
{
std::clog << "\nReceived:\n" << msg << std::endl;
// Use the message.
}
};
MyTagBasedSessionListener listener;
Session session(settings, marketSegmentId, &listener);

Using Tag-based Messages

The following example shows how to access message fields and groups using the Tag-based Messaging subsystem:

void trace(const TagBased::Message& message)
{
{
// Non-optional fields:
std::cout
// Fix Type of the message
<< message.type()
// Any time-stamp field can be converted into
// unsigned 64-bit integer representing ticks since the epoch.
<< ", SendingTimeEpoch: " << message.getTimestamp(TagBased::Tags::SendingTimeEpoch)
// It can also be accessed as a raw number:
<< ", SendingTimeEpoch Raw: " << message.getUInt64(TagBased::Tags::SendingTimeEpoch)
<< ", ManualOrderIndicator: "
// Optional fields:
std::cout
<< ", QuoteReqId: ";
UInt64 quoteReqIdValue;
if(message[TagBased::Tags::QuoteReqId].toNumber(quoteReqIdValue))
std::cout << quoteReqIdValue;
else
std::cout << "Not presented";
// Alternatively:
std::cout
<< ", LiquidityFlag: ";
const TagBased::Field liquidityFlagField =
if(liquidityFlagField)
std::cout
<< BooleanNULL::toString(liquidityFlagField.cast<BooleanNULL>());
else
std::cout << "Not presented";
// Alternatively:
std::cout
<< ", ShortSaleType: ";
try
{
std::cout
}
catch(std::runtime_error&)
{
std::cout << "Not presented";
}
// Group:
const TagBased::Group entries =
if(entries)
{
for(
index != entries.size();
++index)
{
const TagBased::GroupEntry entry =
entries[index];
std::cout
<< ", BidPx[" << index << "]: "
}
}
}
}