Sometimes an application needs more flexibility than a static configuration provides. For example, test programs or simulators may not want to predefine define every session.
Dynamic sessions are implemented using a session provider. A simple session
provider implementation, DynamicAcceptorSessionProvider
, is available for
simple applications. This provider specifies a session ID for a session definition that
will be used for setting session options. The session template in the configuration
file should be marked with the AcceptorTemplate=Y
setting so the
session will not be registered as an normal session.
You programatically associate a specific acceptor socket address with a session provider instance. A dynamic session will be created for any logon attempt on this socket address if a session has not already been defined. This allows a mixture of static session definitions and dynamic session definition on the same acceptor socket.
Registration of a dynamic session provider:
acceptor.setSessionProvider(socketAddress, new DynamicAcceptorSessionProvider( settings, templateSessionID, application, messageStoreFactory, logFactory, messageFactory));
Example acceptor configuration for dynamic sessions:
[default] FileStorePath=target/data/executor ConnectionType=acceptor SocketAcceptPort=9876 StartTime=00:00:00 EndTime=00:00:00 HeartBtInt=30 ValidOrderTypes=1,2,F SenderCompID=* TargetCompID=* UseDataDictionary=Y DefaultMarketPrice=15 [session] AcceptorTemplate=Y DataDictionary=FIX40.xml BeginString=FIX.4.0