OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.9
API Documentation
Order Entry Service Gateway Sample

This sample shows how to connects to the the Order Entry Service Gateway.

When the session is established, the PartyDetailsDefinitionRequest SBE message is sent to the counterparty.

Source code

#include "../Common/Helpers.h"
#include "../Common/Listener.h"
namespace
{
class MyListener : public Listener
{
public:
void onBusinessReject(const BusinessReject521& msg, Session* /*sn*/) ONIXS_ILINK3_OVERRIDE
{
Listener::onBusinessReject(msg, ONIXS_ILINK3_NULLPTR);
if (BusinessRejectReason::ValueIsIncorrect == msg.businessRejectReason())
{
clog << "\nWARNING: Please check that you are connecting to the Order Entry Service Gateway IP address. "
<< "It can be found in the MSGW_Config.xml file from sftpng.cmegroup.com ." << endl;
/*
For example:
<marketsegment id="12" label="Order Entry Service Gateway">
<protocol>TCP/IP</protocol>
<primary-host-ip>IP-ADDRESS-VALUE</primary-host-ip>
*/
}
}
};
void usage()
{
std::cerr << "usage: [Host] [Port] (PartyDetailsListReqID)" << std::endl;
}
}
int main(int argc, char * argv[])
{
std::clog << "CME iLink 3 Order Entry Service Gateway Sample." << endl << endl;
if (argc < 3)
{
usage();
return 1;
}
const std::string host = argv[1];
const Port port = atoi(argv[2]);
const Messaging::UInt64 partyDetailsListReqID = argc > 3 ? atol(argv[3]) : PartyDetailsListReqID;
try {
SignalHelper::manageLinuxSignals();
const int OrderEntryServiceGatewaySegmentId = 12;
const SessionSettings settings = fillSettings();
MyListener listener;
Session session(settings, OrderEntryServiceGatewaySegmentId, &listener);
PartyDetailsDefinitionRequest request;
Helper::setPartyDetailsDefinitionRequestFields(request, partyDetailsListReqID, settings);
if(session.negotiated())
session.reset(true);
session
.connect(host, port)
.send(request);
clog << "\nThe PartyDetailsDefinitionRequest message was sent." << endl;
Helper::waitUntilEnterKey("disconnect the session and terminate the application");
session.disconnect();
}
catch(const std::exception & ex) {
cerr << "\nEXCEPTION: " << ex.what() << endl;
return 1;
}
return 0;
}