Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Session Management : Setting session parameters
Setting session parameters
You can specify one or more parameters to be applied when connecting to a session.
To set parameters
1. Use a session handler factory to create a session handler object. For example:
com.apama.SessionHandler sessionHandler :=
(new com.apama.session.SessionHandlerFactory).create(mainContext);
2. Create a com.apama.utils.Params object.
3. Add a parameter name/value pair to the parameters object you created.
4. Repeat the previous step for each parameter you want to add.
5. Execute the setParameters() action on the session handler object and pass it the Params object you created.
6. Execute the connect() or connectCb() actions on the session handler object. When you connect to the specified session it applies the parameters you added.
For example:
using com.apama.session.SessionHandlerFactory;
using com.apama.session.SessionHandler;
using com.apama.utils.Params;
 
monitor SessionExample5 {
 
context mainContext := context.current();
 
action onload() {
SessionHandler sessionHandler :=
(new SessionHandlerFactory).create(mainContext);
 
// Create a parameters object
Params params := new com.apama.utils.Params;
 
// Add a parameter and then set it for the session handler
params.addParam("MyParam","ParamValue");
sessionHandler.setParams(params);
 
// Connection will use the parameter
sessionHandler.connect("MySession", "MyTransport");
}
. . .
}
}
To find out if there are any parameters set for a session handler, execute the getParameters() action on the session handler object. This action returns a Params object, which you can use if you want to add, change, or remove a parameter. The getParameters() action returns only the parameters you explicitly set and not any implicit parameters that have default values.
Any changes you make to parameters do not apply to existing connections. To apply one or more new parameters to an existing connection, you must diconnect and then re-connect.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback