Search code examples
quickfixn

Quickfix/N the callbacks ToApp ToAdming is not trigering in Initiator


I created simple quickfix application:

 public static void Main()
    {
        SessionSettings settings = new SessionSettings("C:\\Users\\user\\Desktop\\Work\\QFLib\\config\\Config2.txt");
        MyQuickFixApp myApp = new MyQuickFixApp();
        IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
        ILogFactory logFactory = new FileLogFactory(settings);
        var acceptor = new SocketInitiator(
            myApp,
            storeFactory,
            settings,
            logFactory);
        bool sendlogon = true;
        acceptor.Start();
        while (true)
        {
            if(sendlogon)
            myApp.SendLogonRequest(myApp.session.SessionID);
            sendlogon = false;
            Thread.Sleep(1000);
        }
        acceptor.Stop();
    }

}

The problem server is not getting requests, and not sending response. The configs looks okay and generated message also looks good. I also sending generated message via TCP client and in that case on server I get parse error and no response. The config file:Config file The logs:logs


Solution

  • As Cristoph John answered I didn't need to send logon. I just needed to add code to autologin:

    public void ToAdmin(Message msg, SessionID sessionID) 
        {
            Console.WriteLine("ToAdmin " + msg);
            if (msg.GetType() == typeof(QuickFix.FIX44.Logon))
            {
                msg.SetField(new Password("Password"));
                msg.SetField(new ResetSeqNumFlag(true));
            }
        }