3

will anybody please help me understand the difference between session.logout and session.generateLogout.

One can also create and send a logout message explicitly. How is that different from the other two?

Necreaux
  • 9,451
  • 7
  • 26
  • 43
h.i
  • 515
  • 1
  • 5
  • 16

2 Answers2

3

The logout method is the way to go. It will change the enabled flag which will trigger the public void next() method called by a timer. This will use the generateLogout() method to send the correct FixMessage(35=5). The generateLogout methods are all private except the one with no parameters which where changed to public with a changeset with no reason, so I guess this happens unexpected, since it is just a helper method for creating the message. Its the same for the logon you call public void logon() which changes the state and will trigger public void next() which calls private void generateLogon().

Session.java

mszalbach
  • 10,612
  • 1
  • 41
  • 53
  • i dont feel comfortable with logout as it stops qfixj from reconnecting to corresponding session. one needs to call logon in order start reconnection again. – h.i Jun 02 '15 at 08:50
1

First of, by looking at the Javadoc for QuickFIX/J, one could argue it is kind of lacking the information needed for the methods you choose between.

My recommendation for you is to look at the source code for this project and compare the methods (one of the benefits of open source software).

At a glance, see below for differences between the methods,

The logout() method only calls setEnabled(false)

while the

generateLogout(Message otherLogout, String text, SessionStatus sessionStatus)

calls all different kinds of things. For example it prepares a logout message, setting a session status and so on.

In summary, it seems the generateLogout() method is a more proper way to logout.

mattias
  • 2,079
  • 3
  • 20
  • 27
  • the version of qfixj i am using does not support generateLogout. what if i create and send a logout (35=5) explicitly. will that be ok? – h.i Jun 02 '15 at 08:53