Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Session Management : Understanding sessions
Understanding sessions
A CMF application uses a session to send data to and receive data from the connected datasource. A different session is required for each datasource a CMF application needs to connect to. Examples of datasources:
*An adapter that connects to an exchange, such as NASDAQ, LSE, NYSE
*An adapter that connects to an external system such as a database, a message bus
*The CMF market data simulator
When you know which datasource you want your CMF application to use you must obtain the session ID and the transport ID for that datasource. You need to know these values beforehand in order to connect your CMF application to that datasource. Typically, you obtain this information from the documentation for the adapter you want to connect to.
You can use the same com.apama.session.SessionHandlerFactory instance to create multiple com.apama.session.SessionHandler instances, which in turn can be used to connect to different datasources or the same datasource.
A SessionHandler instance can connect to only a single session at one time. In other words, you cannot use the same session handler instance to connect to more than one session at one time. You can, however, disconnect from one session and reuse the same session handler to connect to a different session.
A CMF application can use multiple session handler instances that all use the same underlying session to connect to the same datasource. This can be done in the same monitor, or in different monitors in the same or different contexts. The actual connection (and login, if that is relevant) is made to the datasource and is created only once. Subsequent instances of the session handler that specify the same session identifiers connect to the same datasource and reuse the original established session.
You cannot route or enqueue an instance of a session handler outside the monitor it was created in. You would have multiple instances of a session handler throughout your application connecting to the same session wherever you need direct access to that session. For example, suppose you subscribe to depth updates in one monitor, and tick updates from the same datasource in another monitor or context. Each subscription requires a separate session handler instance for that session.
When an adapter/IAF process starts it automatically connects to and registers with the correlator specified in the adapter's configuration file. (Injection of the Session Manager bundle is required for registration to occur.) Registration makes a session for that adapter/datasource available. After registration, the correlator has the adapter's session ID and transport ID and can use those values to provide a session that a CMF application can connect to in order to communicate with the adapter. A CMF application can connect to only registered sessions. If an application needs a list of all registered sessions, it can obtain that information by execution of the com.apama.session.SessionManagerInterface.getAllSessionInfo() action. See the ApamaDoc for details.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback