[QFJ-108] Session management, especially for Forex (example: Hotspot) Created: 16/Nov/06  Updated: 24/Jan/07  Resolved: 24/Jan/07

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.0.4
Fix Version/s: None

Type: Improvement Priority: Default
Reporter: Welf Wustlich Assignee: Steve Bate
Resolution: Not a bug Votes: 0
Labels: None
Environment:

linux, netbeans


Issue Links:
Relates
is related to QFJ-107 session management functionality at a... Closed

 Description   

First I have to say sorry, I have really tryed to make it short - but it became longer
Second: Thanks to Steve who patiently answers all the questions (not only mine)

Its all about my problems doing (I think typical) session management with QFJ.

Reffering to my last request "session management at application level" I have additional problems:
Like Steve said its possible to use any external tools or cron jobs, the problem with them is, that they need to be coordinated with the FIX sessions, what is additional (unneccessary) logic.
Now I did this and the following problem occured:
We are running FIX sessions with Hotspot, they are active approx 23 hours per day. In the break of 1 hour we'd like/need to cleanup the system especially we'd like to archive logfiles (approx 700MByte per day).
I did this now using a system functionality (cron), since the two logfiles (event.log and messages.log) were NOT created again from the engine when the new session starts up again we lost a half day of data in the logfiles (database was still written in that period).
Now I assume, that I can not remove the logfiles in a session break, otherwise Im loosing them.
Since I can not find these information in the documentation, its learning by doing ;-(.

My actual conclusion (I might be wrong) is, that when I need to cleanup the system in a session break, I need to restart the entire engine, because otherwise the logfiles are not created.
The problem of session management should be very general for FIX-users, most trading application need some basic functionality:

  • run session from start time till end time (while start time could be later than end time, e.g. Forex)
  • run session from start day till end day (e.g. sunday till friday)
  • do something in the outer session time (e.g. cleaning up the system)
    What I understood, is that actually this is not possible with QFJ, or I was not able to use QFJ correctly at this point.
    The actual solution we are going to implement now is as follows:
    Since we get a logout information (when logout or when disconnect), we implement an own time management logic into our application, what does nothing in case of abnormal disconnect, but cleans up and restarts the engine in case of session break (to recreate the logfiles).

Best regards, Welf



 Comments   
Comment by Welf Wustlich [ 16/Nov/06 ]

Well, after screening some code it seems there is a solution for one problem:
in Class: Session.java is a method:
/**

  • Predicate for determining if the session should be active at the current
  • time.
    *
  • @return true if session should be active, false otherwise.
    */
    public boolean isSessionTime() { return sessionSchedule.isSessionTime(); }

this could be used at application level to determine if the session should run or not.
So: just in case of an logout message, I can check at application level:
if (!isSessionTime()) {
cleanupMySystem();
}
Now there are the following questions left:
a) How can I organize that my QFJ engine generates a new logfile after archiving the old one without a complete engine restart?
b) Why did Steve told me that this functionality is not implemented in QFJ in "session management at application level" a missunderstanding or do I overlook something?
c) How its possible to organize a typical Forex session type (start time is after stop time, start day is sunday, end day is friday)?

If somebody has done this or some good hints available this would help.
Preferably there should be added a small cookbook -like example section in the session management-docu.

Best regards, Welf

Comment by Steve Bate [ 16/Nov/06 ]

I forgot about that method being exposed. It's not intended for application usage, but it might work. Or there might be other side effects. I can't predict the results because I haven't tried it. If I were you, I'd shut down my servers during the break, do my log file management and end of day operations and restart the servers. The log files will still be open when you call cleanupMySystem() so on Windows, for example, the process will still be locking the file. Another option is that you could write your own file-based logger with special behavior if you have problems. Or you could use Log4J as the logger and use one of their rolling file appenders (see the Log4J documentation for more details).

For question c), see the session configuration documentation. Set the start day/time and the end day/time. It's ok for the start time to be after the end time.

For the earlier questions, I'd recommend posting these to the mailing list. Other people may have suggestions based on their own forex implementations.

Generated at Sat Nov 23 11:11:58 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.