com.apama.md
Event TradeSubscriber


A helper interface event for subscribing to Trade Market Data Datastream type. The interface must be constructed using the com.apama.md.TradeSubscriberFactory supplying a connected com.apama.session.SessionHandler.

The Handler supplies:-
- Default update callback (which does nothing and allows the user to setup listeners for the Trade events).
- Common universal error callback used for all errors (failed subscriptions, session errors, etc) and a default implementation which logs at the ERROR level.
- By default, the subscriber will use the COMPOUND_DELTA transfer mode. It has a default parameter "TRANSFER_MODE":"COMPOUND_DELTA".
Since:
CMF 5.1.0
See Also:
com.apama.md.TradeSubscriberFactory - Factory event to create this interface.
com.apama.session.SessionHandler - Session Handler event you must provide on interface construction.
com.apama.md.HandlerErrorConstants - Event containing the possible Error constants.
com.apama.utils.Params - The Parameters event.
com.apama.utils.Error - The Error event.
com.apama.md.T - The underlying Trade datastream event.

Member summary
 action<string>subscribe

Subscribe to the supplied symbol using the currently set parameters, update and error callbacks - which may be the defaults if not overridden. You can only subscribe to a specific symbol once per subscriber.
 action<string, action<com.apama.md.client.CurrentTradeInterface>>subscribeCb

Subscribe to the supplied symbol using the supplied update callback and the currently set parameters and error callback which may be the defaults if not overridden.
 action<sequence<string>>multipleSubscribe

Subscribe to the supplied sequence of symbols using the currently set parameters, update and error callback which may be the defaults if not overridden. You can only subscribe to a specific symbol once per subscriber.
 action<sequence<string>, action<com.apama.md.client.CurrentTradeInterface>>multipleSubscribeCb

Subscribe to the supplied sequence of symbols using the supplied update callback and the currently set parameters and error callback which may be the defaults if not overridden.
 action<string>unsubscribe

Unsubscribe from the supplied symbol. You can only unsubscribe from a symbol previously subscribed to by this subscriber.
 action<string, action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>>unsubscribeCb

Unsubscribe from the supplied symbol and call the supplied callback when successfully unsubscribed. You can only unsubscribe from a symbol previously subscribed to by this subscriber.
 action<sequence<string>>multipleUnsubscribe

Unsubscribe to the supplied sequence of symbols. You can only unsubscribe from a symbol previously subscribed to by this subscriber.
 action<sequence<string>, action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>>multipleUnsubscribeCb

Unsubscribe to the supplied sequence of symbols and call the supplied callback per symbol when successfully unsubscribed. You can only unsubscribe from a symbol previously subscribed to by this subscriber.
 action<action<com.apama.md.client.CurrentTradeInterface>> returns integeraddUpdateCallback

Add this callback to the set called on data updates to be used in subsequent subscriptions. This does not affect any current subscriptions.
 action<integer>removeUpdateCallback

Remove the Update callback identified by the result of "addUpdateCallback" from the set used in subsequent subscriptions. This does not affect any current subscriptions with registered update callbacks.
 action<>clearUpdateCallbacks

Clear any currently set Update callbacks.
 action<action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> returns integeraddSubscribedCallback

Add this callback to the set called on successful subscription.
 action<integer>removeSubscribedCallback

Remove the Subscribed callback identified by the result of "addSubscribedCallback".
 action<>clearSubscribedCallbacks

Clear any currently set Subscribed callbacks.
 action<action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> returns integeraddUnsubscribedCallback

Add this callback to the set called on successful unsubscription.
 action<integer>removeUnsubscribedCallback

Remove the Unsubscribe callback identified by the result of "addUnsubscribedCallback".
 action<>clearUnsubscribedCallbacks

Clear any currently set Unsubscribe callbacks.
 action<action<com.apama.md.TradeSubscribercom.apama.utils.Error>> returns integeraddErrorCallback

Add this Error callback to the set called on an error.
 action<integer>removeErrorCallback

Remove the Error Callback identified by the result of "addErrorCallback".
 action<>clearErrorCallbacks

Clear any currently set Error callbacks.
 action<com.apama.md.TradeSubscribercom.apama.utils.Error>defaultErrorCallback

Call the default Error callback as supplied by the subscriber (which logs the error at ERROR level). You may call this from an overridden Error callback (to get the log message) but it is not required.
 action<com.apama.utils.Params>setParams

Set the Parameters in this subscriber to a copy of the supplied parameters, to be used in subsequent subscriptions.
 action<> returns com.apama.utils.ParamsgetParams

Get a copy of the current parameters of this subscriber. It has a default parameter "TRANSFER_MODE":"COMPOUND_DELTA".
 action<> returns com.apama.session.SessionHandlergetSessionHandler

Get the Session Handler associated with this subscriber.
 action<string> returns booleanhasData

Find out if the supplied symbol has received any data.
 action<string> returns com.apama.md.client.CurrentTradeInterfacegetCurrentTrade

Get the com.apama.md.client.CurrentTradeInterface for the supplied symbol, or an uninitialized interface if the symbol is unknown.
 action<string> returns com.apama.md.adapter.ConnectionKeygetConnectionKey

Get the Connection Key for the supplied symbol, or an uninitialized event if the symbol is unknown.
 action<string> returns booleanisSubscribed

Find out if this subscriber has a current subscription for the supplied symbol. The subscription may still be subscribing.
 
Member detail

addErrorCallback

action<action<com.apama.md.TradeSubscribercom.apama.utils.Error>> returns integer addErrorCallback
Add this Error callback to the set called on an error.

Parameters:
cbError - The Error callback.
The parameters for cbError are:
subscriber - The TradeSubscriber.
error - The Error event.
Returns:
Ref Id used to remove the connected callback.
See Also:
com.apama.md.HandlerErrorConstants - 

addSubscribedCallback

action<action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> returns integer addSubscribedCallback
Add this callback to the set called on successful subscription.

Parameters:
cbSubscribed - The callback.
The parameters for cbSubscribed are:
subscriber - The TradeSubscriber.
connKey - The ConnectionKey of the subscription.
Returns:
Ref Id used to remove the Subscribed callback.
See Also:
com.apama.md.TradeSubscriber#removeSubscribedCallback - This action should be called with the returned refId to remove this callback.

addUnsubscribedCallback

action<action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> returns integer addUnsubscribedCallback
Add this callback to the set called on successful unsubscription.

Parameters:
cbUnsubscribed - The unsubscribe callback.
The parameters for cbUnsubscribed are:
subscriber - The TradeSubscriber.
connKey - The ConnectionKey of the subscription.
Returns:
Ref Id used to remove the unsubscribe callback.
See Also:
com.apama.md.TradeSubscriber#removeUnsubscribedCallback - This action should be called with the returned refId to remove this callback.

addUpdateCallback

action<action<com.apama.md.client.CurrentTradeInterface>> returns integer addUpdateCallback
Add this callback to the set called on data updates to be used in subsequent subscriptions. This does not affect any current subscriptions.

Parameters:
cbUpdate - The callback.
The parameters for cbUpdate are:
iface - A CurrentTradeInterface.
Returns:
Ref Id used to remove the Update callback.
See Also:
com.apama.md.TradeSubscriber#removeUpdateCallback - This action should be called with the returned refId to remove this callback.

clearErrorCallbacks

action<> clearErrorCallbacks
Clear any currently set Error callbacks.
See Also:
com.apama.md.TradeSubscriber#addErrorCallback - 

clearSubscribedCallbacks

action<> clearSubscribedCallbacks
Clear any currently set Subscribed callbacks.
See Also:
com.apama.md.TradeSubscriber#addSubscribedCallback - 

clearUnsubscribedCallbacks

action<> clearUnsubscribedCallbacks
Clear any currently set Unsubscribe callbacks.
See Also:
com.apama.md.TradeSubscriber#addUnsubscribedCallback - 

clearUpdateCallbacks

action<> clearUpdateCallbacks
Clear any currently set Update callbacks.
See Also:
com.apama.md.TradeSubscriber#addUpdateCallback - 

defaultErrorCallback

action<com.apama.md.TradeSubscribercom.apama.utils.ErrordefaultErrorCallback
Call the default Error callback as supplied by the subscriber (which logs the error at ERROR level). You may call this from an overridden Error callback (to get the log message) but it is not required.

Parameters:
subscriber - The TradeSubscriber.
error - The Error event.

getConnectionKey

action<string> returns com.apama.md.adapter.ConnectionKey getConnectionKey
Get the Connection Key for the supplied symbol, or an uninitialized event if the symbol is unknown.

Parameters:
symbol - The symbol
Returns:
The Connection Key for the supplied symbol, or an uninitialized event if the symbol is unknown.
See Also:
com.apama.md.adapter.ConnectionKey - 

getCurrentTrade

action<string> returns com.apama.md.client.CurrentTradeInterface getCurrentTrade
Get the com.apama.md.client.CurrentTradeInterface for the supplied symbol, or an uninitialized interface if the symbol is unknown.

Parameters:
symbol - The symbol
Returns:
The Current Trade Interface for the last trade, or an uninitialized interface if the symbol is unknown.
See Also:
com.apama.md.client.CurrentTradeInterface - 

getParams

action<> returns com.apama.utils.Params getParams
Get a copy of the current parameters of this subscriber. It has a default parameter "TRANSFER_MODE":"COMPOUND_DELTA".

Returns:
The parameters.
See Also:
com.apama.utils.Params - 

getSessionHandler

action<> returns com.apama.session.SessionHandler getSessionHandler
Get the Session Handler associated with this subscriber.

Returns:
The Session Handler.
See Also:
com.apama.session.SessionHandler - 

hasData

action<string> returns boolean hasData
Find out if the supplied symbol has received any data.

Parameters:
symbol - The symbol
Returns:
true if the supplied symbol has data. False if the symbol is unknown or has not yet had data.

isSubscribed

action<string> returns boolean isSubscribed
Find out if this subscriber has a current subscription for the supplied symbol. The subscription may still be subscribing.

Parameters:
symbol - The symbol
Returns:
True if this subscriber has a current subscription for that symbol.

multipleSubscribe

action<sequence<string>> multipleSubscribe
Subscribe to the supplied sequence of symbols using the currently set parameters, update and error callback which may be the defaults if not overridden. You can only subscribe to a specific symbol once per subscriber.

Parameters:
symbols - A sequence of symbols to subscribe to.

multipleSubscribeCb

action<sequence<string>, action<com.apama.md.client.CurrentTradeInterface>> multipleSubscribeCb
Subscribe to the supplied sequence of symbols using the supplied update callback and the currently set parameters and error callback which may be the defaults if not overridden.

You can only subscribe to a specific symbol once per subscriber. This will ignore any currently set Update callbacks in the subscriber and only use the supplied Update callback.

Parameters:
symbols - A sequence of symbols to subscribe to.
cbUpdate - The update callback.
The parameters for cbUpdate are:
iface - A CurrentTradeInterface.

multipleUnsubscribe

action<sequence<string>> multipleUnsubscribe
Unsubscribe to the supplied sequence of symbols. You can only unsubscribe from a symbol previously subscribed to by this subscriber.

Parameters:
symbols - A sequence of symbols to unsubscribe from.

multipleUnsubscribeCb

action<sequence<string>, action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> multipleUnsubscribeCb
Unsubscribe to the supplied sequence of symbols and call the supplied callback per symbol when successfully unsubscribed. You can only unsubscribe from a symbol previously subscribed to by this subscriber.

This will ignore any currently set Unsubscribed callbacks in the subscriber and only use the supplied Unsubscribed callback.

Parameters:
symbols - A sequence of symbols to unsubscribe from.
cbUnsubscribed - The callback for successful unsubscription.
The parameters for cbUnsubscribed are:
subscriber - A TradeSubscriber.
connKey - The ConnectionKey of the unsubscription.

removeErrorCallback

action<integer> removeErrorCallback
Remove the Error Callback identified by the result of "addErrorCallback".

Parameters:
refId - The reference Id as returned from the call to "addErrorCallback".
See Also:
com.apama.md.TradeSubscriber#addErrorCallback - 

removeSubscribedCallback

action<integer> removeSubscribedCallback
Remove the Subscribed callback identified by the result of "addSubscribedCallback".

Parameters:
refId - The reference Id as returned from the call to "addSubscribedCallback".
See Also:
com.apama.md.TradeSubscriber#addSubscribedCallback - 

removeUnsubscribedCallback

action<integer> removeUnsubscribedCallback
Remove the Unsubscribe callback identified by the result of "addUnsubscribedCallback".

Parameters:
refId - The reference Id as returned from the call to "addUnsubscribedCallback".
See Also:
com.apama.md.TradeSubscriber#addUnsubscribedCallback - 

removeUpdateCallback

action<integer> removeUpdateCallback
Remove the Update callback identified by the result of "addUpdateCallback" from the set used in subsequent subscriptions. This does not affect any current subscriptions with registered update callbacks.

Parameters:
refId - The reference Id as returned from the call to "addUpdateCallback".
See Also:
com.apama.md.TradeSubscriber#addUpdateCallback - 

setParams

action<com.apama.utils.ParamssetParams
Set the Parameters in this subscriber to a copy of the supplied parameters, to be used in subsequent subscriptions.

Parameters:
parameters - The parameters.
See Also:
com.apama.utils.Params - 

subscribe

action<string> subscribe
Subscribe to the supplied symbol using the currently set parameters, update and error callbacks - which may be the defaults if not overridden. You can only subscribe to a specific symbol once per subscriber.

If successful it will call the currently set Subscribed callbacks in the subscriber and on failure it will call set Error callbacks.

Parameters:
symbol - The symbol to subscribe to.

subscribeCb

action<string, action<com.apama.md.client.CurrentTradeInterface>> subscribeCb
Subscribe to the supplied symbol using the supplied update callback and the currently set parameters and error callback which may be the defaults if not overridden.

You can only subscribe to a specific symbol once per subscriber. This will ignore any currently set Update callbacks in the subscriber and only use the supplied Update callback.

Parameters:
symbol - The symbol to subscribe to.
cbUpdate - The update callback.

unsubscribe

action<string> unsubscribe
Unsubscribe from the supplied symbol. You can only unsubscribe from a symbol previously subscribed to by this subscriber.

To ensure the state associated with the subscription is removed correctly you should unsubscribe only if and when the action registered using the "addSubscribedCallback" has fired to indicate that the subscription was fully established. If successful it will call the currently set Unsubscribed callbacks in the subscriber and on failure it will call set Error callbacks.

Parameters:
symbol - The symbol to unsubscribe from.

unsubscribeCb

action<string, action<com.apama.md.TradeSubscribercom.apama.md.adapter.ConnectionKey>> unsubscribeCb
Unsubscribe from the supplied symbol and call the supplied callback when successfully unsubscribed. You can only unsubscribe from a symbol previously subscribed to by this subscriber.

This will ignore any currently set Unsubscribed callbacks in the subscriber and only use the supplied Unsubscribed callback.

Parameters:
symbol - The symbol to unsubscribe from.
cbUnsubscribed - The callback for successful unsubscription.
The parameters for cbUnsubscribed are:
subscriber - A TradeSubscriber.
connKey - The ConnectionKey of the unsubscription.