1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20
21#include <iostream>
22
25
33
35
36int main(
int argc,
char * argv[])
37{
38
41 > cfg{"ExternalThreadMode", argc, argv};
42
43 try
44 {
46
49
50
52
55
57
58
60 const auto connectTask = bgwSession->connectAsync(bgwCredentials);
61
62 while (!connectTask.is_ready())
64
67
69
70 std::clog << "\nPress <Ctrl+C> to disconnect the BGW session and terminate the application." << std::endl;
71
74
76
77 const auto disconnectTask = bgwSession->disconnectAsync("The BGW session is disconnected");
78
79 while (!disconnectTask.is_ready() || !stack.
isQuiescent())
81 }
82 catch(const std::exception & ex)
83 {
84 std::cerr << "\nEXCEPTION: " << ex.what() << std::endl;
85 return 1;
86 }
87
88 return 0;
89}
#define ONIXS_ICEBOE_NAMESPACE
#define ONIXS_ICEBOE_MESSAGING_NAMESPACE
int main(int argc, char *argv[])
A high-level wrapper over the TCP standard stack.
ONIXS_ICEBOE_FORCEINLINE void dispatchEvents() override
Processes events on a stack and performs the necessary handling.
ONIXS_ICEBOE_FORCEINLINE bool isQuiescent() const override
static MessageHolder< NewOrderRequest > createOrder(const std::string &traderId)
static MessageHolder< TraderLogoutRequest > createTraderLogoutRequest(const std::string &traderId)
static MessageHolder< TraderLogonRequest > createTraderLogonRequest(const std::string &traderId, const std::string &traderPwd)
std::promise< void > traderLoggedOn
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)
std::future< T > wait(Stack &stack, std::promise< T > &promise, std::chrono::seconds timeout=std::chrono::seconds{30})
std::unique_ptr< T > makeUnique(Args &&...args)
@ External
Session events are handled by rolling an event loop in a user thread.
static ONIXS_ICEBOE_FORCEINLINE bool interruptDetected() noexcept
static void manageSignals() noexcept