Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Session Management : Setting session callbacks : Sample code for adding session connection callbacks
Sample code for adding session connection callbacks
After you obtain a session handler and before you use it to connect to a session you can execute SessionHandler.addConnectedCallback() one or more times. This action adds the specified callback to the set of callbacks invoked by CMF when this session handler successfuly connects to a session. Only a subsequent connection, and not an existing connection, is affected. The following sample code shows this.
using com.apama.session.SessionHandlerFactory;
using com.apama.session.SessionHandler;
 
monitor SessionExample4 {
 
context mainContext := context.current();
 
action onload() {
// Create session handler and add a callback
// to be executed upon successful connection
SessionHandler sessionHandler :=
(new SessionHandlerFactory).create(mainContext);
integer refId :=
sessionHandler.addConnectedCallback(onSessionConnected);
sessionHandler.connect("MySession", "MyTransport");
}
 
action onSessionConnected(SessionHandler sessionHandler) {
 
//Use the session handler to subscribe to market data
}
}
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback