34int main(
int argc,
char * argv[])
43 > cfg{
"TCPDirectGettingStarted", argc, argv};
55 class TcpDirectListener :
public Listener
70 traderLoggedOn.get_future().get();
72 catch(
const std::exception& e)
78 session->
send(order_);
91 session->
send(traderLogonRequest_);
113 bool finished()
const noexcept {
return finished_;}
116 bool finished_ {
false};
127 attr.
set(
"interface", cfg.nif());
132 const auto bgwSession= std::make_unique<BgwSession>(stack, settings, &listener, cfg.storage());
133 bgwSession->connectAsync(bgwCredentials);
135 std::clog <<
"\nPress <Ctrl+C> to disconnect the BGW session and terminate the application." << std::endl;
137 while(!listener.finished())
147 bgwSession->disconnectAsync();
152 catch(
const std::exception & ex)
154 std::cerr <<
"\nEXCEPTION: " << ex.what() << std::endl;
#define ONIXS_ICEBOE_NAMESPACE
#define ONIXS_ICEBOE_MESSAGING_NAMESPACE
int main(int argc, char *argv[])
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
Session & send(Messaging::MessageHolder< SbeMessageType, MaxMessageSize, MessageInitializer > &msg, Messaging::Timestamp sendingTime=UtcWatch::now())
Sends the message.
TCPDirect Attributes to pass configuration details (a wrapper around the zf_attr struct).
void set(const std::string &name, const std::string &value)
Sets the attribute to the given value.
A high-level wrapper over the TCPDirect network stack.
bool isQuiescent() const noexcept override
void dispatchEvents() noexcept override
This function processes events on a stack and performs the necessary handling.
static MessageHolder< NewOrderRequest > createOrder(const std::string &traderId)
static MessageHolder< TraderLogonRequest > createTraderLogonRequest(const std::string &traderId, const std::string &traderPwd)
void onStateChange(SessionStateId::Enum newState, SessionStateId::Enum prevState, Session *) override
Called when the session changes its state.
void onError(const Messaging::Error msg, Session *) override
Called when an Error message is received from the counterparty.
void onTraderLogonReport(const Messaging::TraderLogonReport msg, Session *) override
Called when a TraderLogonReport message is received.
std::string traderPwd() const
std::string traderId() const
std::pair< std::unique_ptr< GatewayEmulatorThread< BusSessionGatewayListener > >, std::unique_ptr< GatewayEmulatorThread< GatewayListener > > > createEmulator(const SessionSettings &settings, const ConnectivityConfiguration &cfg, bool tcpDirect=false)
BgwCredentials receiveBgwCredentials(SessionSettings settings, std::string host, Port port)
SessionSettings fillSettings(const LogonConfiguration &logonCfg, const ConnectivityConfiguration &connCfg, const SettingsConfiguration &settingsCfg)
Trader Logon Report for Trader ID.
@ UnsuccessfulLogonReportInReplyOnLogonRequest
The unsuccessful Logon Report message is received in reply to the LogonRequest message.
@ Established
Session is fully established.
@ Disconnected
Session is disconnected.
static ONIXS_ICEBOE_FORCEINLINE bool interruptDetected() noexcept
static void manageSignals() noexcept