pls help -- using ClientManager for 2 sessions (datafeed and trading) inside the same compilation unit

54 views
Skip to first unread message

Raul Gherman

unread,
Mar 29, 2016, 12:58:15 PM3/29/16
to fix8 developer
Hello

please help me generating a valid client-side compilation unit that incorporates 2 sessions -- one for datafeed, one for trading

if i try doing as follows:

unique_ptr<ClientSessionBase> _DataFeedClient(new ReliableClientSession<DATAFEED_session_client>(DATAFEED::ctx(), "FIX44-DATAFEED-CLIENT-SESSION.xml", "DATAFEED"));
unique_ptr<ClientSessionBase> _TradingClient(new ReliableClientSession<TRADING_session_client>(TRADING::ctx(), "FIX44-TRADING-CLIENT-SESSION.xml", "TRADING"));

compilation fails with:

undefined reference to `vtable for TRADING_session_client'


... even though all files based on xml files were generated w/o error

thank you in advance,

best regards,

Raul

Raul Gherman

unread,
Apr 1, 2016, 10:27:14 AM4/1/16
to fix8 developer
one more try:

using the following code, only the _DataFeedClient starts, the second session state remains 0 

... and yes, i used the samples from the Wiki page...

ClientManager.add("_DataFeedClient", new FIX8::ReliableClientSession<LMAX_CLIENT_session_client>(LMAX_CLIENT::ctx(), "LMAX-FIX44-CLIENT-SESSION.xml", "LMAX-DATAFEED"));
ClientManager.add("_TradingClient", new FIX8::ReliableClientSession<LMAX_CLIENT_session_client>(LMAX_CLIENT::ctx(), "LMAX-FIX44-CLIENT-SESSION.xml", "LMAX-TRADING"));

FIX8::ClientSessionBase *_ClientManager(_ClientManager.for_each_if([&](FIX8::ClientSessionBase *pp)
    {
        pp->start(true);

        return States::is_live(pp->session_ptr()->get_session_state());  
    }));

please advise

best regards,

Raul

Raul Gherman

unread,
Apr 1, 2016, 5:10:47 PM4/1/16
to fix8 developer
as suggested by David, i am heading for the support forums, so:

i am using a ClientManager, attaching 2 ReliableClientSessions to it


int main()
{
GlobalLogger::set_global_filename("./logs/Global_Log.log");

ClientManager _ClientManager;

_ClientManager.add("_DataFeedClient", new ReliableClientSession<LMAX_DATAFEED_session_client>(LMAX_DATAFEED::ctx(), "LMAX-FIX44-DATAFEED-CLIENT-SESSION.xml", "LMAX-DATAFEED"));
_ClientManager.add("_TradingClient", new ReliableClientSession<LMAX_DATAFEED_session_client>(LMAX_TRADING::ctx(), "LMAX-FIX44-TRADING-CLIENT-SESSION.xml", "LMAX-TRADING"));

ClientSessionBase *csb(_ClientManager.for_each_if([&](ClientSessionBase *pp)

{ pp->start(false, next_send, next_receive, pp->session_ptr()->get_login_parameters()._davi()); // if you use ReliableClientSession, you need to return true here always return true; }

));

if (csb)
cerr << csb->_session_name << " failed to start" << endl;

vector<thread> thrds;
_ClientManager.for_each_if([&](ClientSessionBase *pp)
{
// we should be running client_process however this won't work
// since two threads can't share the same console
thrds.push_back(thread (=() // use copy closure

{ *pp->session_ptr(), 0, cout; hypersleep<h_seconds>(1); }

));
return true;
});

for_each(thrds.begin(), thrds.end(), [](thread& tt)

{ if (tt.joinable()) tt.join(); }

);

return 0;
}


unfortunately, result is (at first heartbeat):

LMAX_DATAFEED_session none => not_logged_in
LMAX_DATAFEED_session not_logged_in => logon_sent
LMAX_DATAFEED_session none => not_logged_in
LMAX_DATAFEED_session not_logged_in => logon_sent
LMAX_DATAFEED_session logon_sent => logon_received
LMAX_DATAFEED_session logon_received => continuous
LMAX_DATAFEED_session logon_sent => logon_received
LMAX_DATAFEED_session logon_received => continuous
Segmentation fault (core dumped)


On Tuesday, March 29, 2016 at 7:58:15 PM UTC+3, Raul Gherman wrote:
Reply all
Reply to author
Forward
0 new messages