问题
I can configure multiple sessions in a single QuickFIX/J settings file and then start them all with a single SocketInitiator
. But I would like to be able to modify the configuration of one or more sessions and then restart just those sessions without affecting any others.
I could do this by having multiple settings files and using one SocketInitiator
per session. But it seems as though QuickFIX/J is not intended to be used this way. Would it cause me any problems?
回答1:
It is perfectly fine to start up an Initiator
per session. It is a matter of taste. In any case: having a separate Initiator
per session is independent and will not affect the other sessions.
If you want to follow the approach with a single Initiator
then you could try to add/remove sessions dynamically via createDynamicSession()
/removeDynamicSession()
. There still is some manual work though.
- Find the
Session
that you want to reload.logout()
andclose()
it. - Call
removeDynamicSession()
for thatSession
. - Get the settings for the
SessionID
that you want to reload from the runningInitiator
. Remove these from the runningInitiator
viaremoveSetting()
. - Then reload the settings from the settings file for the needed
Session
and put them to the settings of theInitiator
. - Then call
createDynamicSession()
for theSessionID
来源:https://stackoverflow.com/questions/61611047/how-to-manage-and-reload-multiple-quickfix-j-sessions-independently