Understanding subscribers
A CMF application uses a subscriber to obtain market data from the connected datasource and to specify callbacks to be executed upon receiving market data. A different subscriber is required for each type of market data a CMF application requires. There are subscribers for the following types of market data:
BBA
Depth
News
Orderbook
Quotebook
Trade
For each type of market data, an application can create any number of subscribers. In a monitor, or in two different monitors, you can use two different subscriber objects to subscribe to the same symbol with the same parameters. However, you cannot use the same subscriber object to subscribe to the same symbol with the same parameters more than once. If you try to it is a DUPLICATE_SUBSCRIPTION error.
You can use the same subscriber object to subscribe to the same symbol more than once only if you specify at least one different parameter for each subscription. The adapter handles each such subscription as a separate and distinct subscription.
Depending on the adapter, data might be sent once for multiple subscriptions for the same symbol, but it has the potential to be processed multiple times -- once for each subscription.
Separate monitors cannot share subscriber objects. Each monitor that needs market data must subscribe with its own subscribers.
You can add subscribe-callbacks, update-callbacks, and unsubscribe-callbacks before you subscribe. Subsequent subscriptions execute the callbacks you added at the approprite times, that is, upon subscription, market data update, or unsubscription. Alternatively, you can specify an update callback when you subscribe. See
Setting subscription callbacks.