Apama Capital Markets Foundation Documentation : Capital Markets Foundation Guide : Market Data Management : Market data subscribers : Subscribing to market data : Subscription examples : Sample code for subscribing to multiple symbols
Sample code for subscribing to multiple symbols
The following code provides an example of invoking the subscribe() action multiple times to subscribe to multiple symbols. An alternative that has the same result is to invoke the multipleSubscribe() action and specify a sequence of symbols.
using com.apama.session.SessionHandlerFactory;
using com.apama.session.SessionHandler;
using com.apama.md.TradeSubscriberFactory;
using com.apama.md.TradeSubscriber;
 
monitor SubscriberExample4 {
 
context mainContext := context.current();
 
action onload() {
SessionHandler sessionHandler :=
(new SessionHandlerFactory).connect(
mainContext, "MySession", "MyTransport");
 
TradeSubscriber tradeSubscriber :=
(new TradeSubscriberFactory).create(sessionHandler);
tradeSubscriber.subscribe("EUR/USD");
tradeSubscriber.subscribe("EUR/GBP");
tradeSubscriber.subscribe("USD/GBP");
}
}
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback