h.i
h.i

Reputation: 525

Quickfixj : difference between logout methods

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?

Upvotes: 3

Views: 504

Answers (2)

mszalbach
mszalbach

Reputation: 11470

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

Upvotes: 3

mattias
mattias

Reputation: 2108

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.

Upvotes: 1

Related Questions