Quickfixj: difference between exit methods

someone please help me understand the difference between session.logout

and session.generateLogout

.

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

+3


source to share


2 answers


The exit method is the way to go. It will change the enabled flag, which will call the method public void next()

called by the timer. This will use the method generateLogout()

to send the correct FixMessage (35 = 5). The generateLogout methods are private, except those that have no parameters that have been changed to public with a changeset for no reason, so I guess this happens unexpectedly as it is just a helper method for generating a message. It's the same for login which you call public void logon()

which changes state and public void next()

which calls which calls private void generateLogon()

.



Session.java

+2


source


First of all, by looking at the Javadoc for QuickFIX / J, you could argue that this is a lack of information required 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).

Briefly, see below the differences between the methods,

The method logout()

only callssetEnabled(false)



while

generateLogout(Message otherLogout, String text, SessionStatus sessionStatus)

causes all sorts of things. For example, it prepares a logout message, sets the session status, etc.

Overall, it seems that the method generateLogout()

is the more correct way to log out.

+1


source







All Articles