How to manage and reload multiple QuickFIX/J sessions independently?

依然范特西╮ 提交于 2021-01-03 05:59:35

问题


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.

  1. Find the Session that you want to reload. logout() and close() it.
  2. Call removeDynamicSession() for that Session.
  3. Get the settings for the SessionID that you want to reload from the running Initiator. Remove these from the running Initiator via removeSetting().
  4. Then reload the settings from the settings file for the needed Session and put them to the settings of the Initiator.
  5. Then call createDynamicSession() for the SessionID


来源:https://stackoverflow.com/questions/61611047/how-to-manage-and-reload-multiple-quickfix-j-sessions-independently

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!