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:
{
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;
}
}
};
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);
session
clog << "\nThe PartyDetailsDefinitionRequest message was sent." << endl;
Helper::waitUntilEnterKey("disconnect the session and terminate the application");
}
catch(const std::exception & ex) {
cerr << "\nEXCEPTION: " << ex.what() << endl;
return 1;
}
return 0;
}