Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Market Data Management : Market data subscribers : Setting subscription parameters
Setting subscription parameters
You can specify one or more parameters to be applied when subscribing to market data. For example, you might specify a parameter that is related to MDA, such as TRANSFER_MODE, or a custom parameter to be sent as part of the subscription to a datasource.
To set parameters
1. Use a subscriber factory to create a subscriber for the relevant type of market data. For example:
com.apama.md.TradeSubscriber tradeSubscriber :=
(new com.apama.md.TradeSubscriberFactory).create(sessionHandler);
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 subscriber.
6. Execute one of the subscribe actions on the subscriber. When MDA processes the subscription it applies the parameters you added.
For example:
using com.apama.session.SessionHandlerFactory;
using com.apama.session.SessionHandler;
using com.apama.md.TradeSubscriberFactory;
using com.apama.md.TradeSubscriber;
using com.apama.utils.Params;
 
monitor SubscriberExample12 {
 
context mainContext := context.current();
 
action onload() {
SessionHandler sessionHandler :=
(new SessionHandlerFactory).connect(
"MySession", "MyTransport");
 
// Create a trade subscriber helper object and a parameters object
TradeSubscriber tradeSubscriber :=
(new TradeSubscriberFactory).create(sessionHandler);
Params params := new Params;
 
// Set a parameter for the subscriber
params.addParam("MyParam","ParamValue");
tradeSubscriber.setParams(params);
 
// Subscription will use the parameter
tradeSubscriber.subscribe("SOW");
}
 
}
To find out if there are any parameters set for a subscription, execute the getParameters() action on the subscriber 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 parameters that are implicitly set with a default value.
Any changes you make to parameters do not apply to existing subscriptions. To apply one or more new parameters to an existing subscription, you must end that subscription and then re-subscribe.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback