Apama Capital Markets Foundation 10.15 | Capital Markets Foundation | Session Management | Connecting to sessions | Sample code for using factory to connect
 
Sample code for using factory to connect
The simplest way to connect to a session is to execute com.apama.session.SessionHandlerFactory.connect(). This action uses the session ID and transport ID that you specify, as well as a reference to the main context, to create a session and connect to that session. For example:
monitor SessionExample1 {
 
context mainContext := context.current();
 
action onload() {
com.apama.session.SessionHandler sessionHandler :=
(new com.apama.session.SessionHandlerFactory).connect(
mainContext, "MySession", "MyTransport");
}
...
}