Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Session Management : Setting session callbacks : Sample code for specifying callback when using handler to connect
Sample code for specifying callback when using handler to connect
One method for connecting to a session is to execute the connectCb() action on SessionHandler. The following example shows a callback invoked by a successful connection to a session. If there is an error that causes the connection to fail then the specified connection callback is ignored.
using com.apama.session.SessionHandlerFactory;
using com.apama.session.SessionHandler;
 
monitor SessionExample3 {
 
context mainContext := context.current();
 
action onload() {
 
// Create a session and obtain a session handler
SessionHandler sessionHandler :=
(new SessionHandlerFactory).create(mainContext);
 
// Use the session handler to connect with a callback
sessionHandler.connectCb(
"MySession", "MyTransport", onSessionConnected);
}
 
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