1

I'm using QuickfixJ to connect to the counter party for FIX message.

However, some day I found the log is as follow:

-20:59:39: Received logout request: Initiating logout
-20:59:39: Sent logout response
-20:59:39: Initiated logon request
-20:59:45: Initiated logon request
-20:59:50: Initiated logon request
-20:59:55: Initiated logon request
-21:00:00: Initiated logon request

Apparently, counter party sent a logout request and my app responded. The session should be finished and closed.

Why the app still trying to initiate a logon request to counter party?

Am I missing something? Because I have no implementation within onLogout(SessionId session) and fromAdmin(Message message, SessionId session) and I thought it could be automatically handled by QuickfixJ itself

macemers
  • 2,194
  • 6
  • 38
  • 55

2 Answers2

3

That's how QF works. If the connection goes down but you're still within the session's active schedule, it tries to reconnect.

It won't stop trying to reconnect until EndTime. Then it sleeps until the next StartTime.

Grant Birchmeier
  • 17,809
  • 11
  • 63
  • 98
  • If I set the `ReconnectInterval=5`, quickfixj will keep trying more than 5 times?? BTW, I have another question about quickfixj and it hasn't solved yet. Would you mind taking a look at it: http://stackoverflow.com/questions/22004162/weird-behavior-of-quickfix-j-after-sent-test-request-test-happens – macemers Mar 12 '14 at 02:39
  • `ReconnectInterval` is the number of seconds between attempts, not the number of attempts. When =5, QF/j will keep trying infinitely, every 5 seconds until EndTime. – Grant Birchmeier Mar 12 '14 at 14:12
  • Understood. If I only need to make x attempts to re-connect, explicit counter should be added within the `onLogout()` to control the retry times. Is that right? Is it a good practice because it seems not a good choice to keep trying until Endtime? – macemers Mar 13 '14 at 02:48
  • A better question is: Why would you want the application to stay up and yet not connect? Why do you want to stop trying to connect? If you don't want to connect, shut your app down. – Grant Birchmeier Mar 13 '14 at 15:24
  • QF is designed for your initiators to stay up all session long. If the connection drops, QF assumes it's a temporary outage, and keeps trying to reconnect until the outage is over. Traders don't like to stop trading or miss market data. – Grant Birchmeier Mar 13 '14 at 15:28
1

It depends whats in your cfg file as ReconnectInterval

[default]
ReconnectInterval=5

and I think it depends on what's in

public void onLogout(SessionID sessionID) {        
    observableLogon.logoff(sessionID);
}

with the reconnects used in case the disco was unexpected or unintended

rupweb
  • 3,052
  • 1
  • 30
  • 57
  • Thx. That means if I left nothing within the onLogout() method and the quickfixj will automatically try 5 times re-connection and then disconnect. If I explicitly logout like this: `Session session = Session.lookupSession(sessionId); if(session.isLoggedOn()){ session.logout("Received Logout Request from Counterparty!"); }` , it will force to disconnect with counterparty without any retry. Is that right? – macemers Mar 12 '14 at 02:36
  • BTW, I have another question about quickfixj and it hasn't solved yet. Would you mind taking a look at it: http://stackoverflow.com/questions/22004162/weird-behavior-of-quickfix-j-after-sent-test-request-test-happens – macemers Mar 12 '14 at 02:40
  • You're probably right and I would have a go. Add your logout handler to your code and start the FIX engine. Pull out your network cable and check the logs to see what happens. Alternatively send the logout request and see what happens. If it tries to reconnect 5 times that's because of the cfg setup. – rupweb Mar 12 '14 at 10:23