The MamaSubscription
interface represents a subscription to a topic.
More...
#include <MamaSubscription.h>
Public Member Functions | |
virtual | ~MamaSubscription () |
MamaSubscription (void) | |
virtual void | setCSubscription (mamaSubscription subscription) |
virtual mamaSubscription | getCSubscription () |
virtual void | setup (MamaTransport *transport, MamaQueue *queue, MamaSubscriptionCallback *callback, const char *source, const char *symbol, void *closure=NULL) |
Set up a subscription. | |
virtual void | setup (MamaQueue *queue, MamaSubscriptionCallback *callback, MamaSource *source, const char *symbol, void *closure=NULL) |
Set up a subscription. | |
virtual void | activate () |
Activate a subscriber using the throttle queue. | |
virtual void | deactivate () |
Deactivate a subscriber. | |
virtual void | create (MamaTransport *transport, MamaQueue *queue, MamaSubscriptionCallback *callback, const char *source, const char *symbol, void *closure=NULL) |
Set up and activate a subscriber using the throttle queue. | |
virtual void | create (MamaQueue *queue, MamaSubscriptionCallback *callback, MamaSource *source, const char *symbol, void *closure=NULL) |
Set up and activate a subscriber using the throttle queue. | |
virtual void | createSnapshot (MamaTransport *transport, MamaQueue *queue, MamaSubscriptionCallback *callback, const char *source, const char *symbol, void *closure=NULL) |
Set up and activate a snapshot subscriber using the throttle queue. | |
virtual void | setRequiresInitial (bool requiresInitial) |
Determines whether the subscription requires an initial value. | |
virtual bool | getRequiresInitial (void) |
Return true if the subscription requires an initial value. | |
virtual bool | getReceivedInitial (void) |
Return true if the subscription has received an initial. | |
virtual void | setRetries (int retries) |
Set the number of retries for initial value requests and recap requests. | |
virtual int | getRetries (void) |
Return the retries. | |
virtual void | setSubscriptionType (mamaSubscriptionType type) |
Set the subscription type. | |
virtual mamaSubscriptionType | getSubscriptionType (void) |
Return the subscription type. | |
virtual long | getServiceLevelOpt (void) |
Return the service level option. | |
virtual void | setServiceLevel (mamaServiceLevel svcLevel, long svcLevelOpt) |
Set the service level. | |
virtual mamaServiceLevel | getServiceLevel (void) |
Return the service level. | |
virtual const char * | getSymbol (void) const |
Return the symbol for this subscription. | |
virtual MamaSubscriptionCallback * | getCallback (void) const |
virtual void | setSymbol (const char *symbol) |
Sets the symbol for this subscription. | |
virtual const MamaSourceDerivative * | getSourceDerivative (void) const |
Return the (subscription-specific) MAMA source derivative for this subscription. | |
virtual MamaSourceDerivative * | getSourceDerivative (void) |
Return the (subscription-specific) MAMA source derivative for this subscription. | |
virtual const MamaSource * | getSource (void) const |
Return the MAMA source for this subscription. | |
virtual const char * | getSubscSource (void) const |
Return the source for this subscription. | |
virtual void | setTimeout (double timeout) |
Set the timeout for this subscription. | |
virtual double | getTimeout (void) |
Return the timeout. | |
virtual void | setRecoverGaps (bool recover) |
Attempt to recover from sequence number gaps by requesting a recap. | |
virtual bool | getRecoverGaps (void) const |
Returns true if listener is configure to recover from sequence number gaps by requesting a recap. | |
virtual void | setAppDataType (uint8_t dataType) |
Set the application data type. | |
virtual uint8_t | getAppDataType () const |
Get the application data type. | |
virtual void | setGroupSizeHint (int groupSizeHint) |
Set a hint to the size of groups when making group subscriptions. | |
virtual void | setItemClosure (void *closure) |
Set the item closure for group subscriptions. | |
virtual void * | getItemClosure (void) |
Get the item closure for group subscriptions. | |
virtual void | setPreInitialCacheSize (int cacheSize) |
Set the number of messages to cache for each symbol before the initial value arrives. | |
virtual int | getPreInitialCacheSize (void) |
Return the initial value cache size. | |
virtual void | setMsgQualifierFilter (bool ignoreDefinitelyDuplicate, bool ignorePossiblyDuplicate, bool ignoreDefinitelyDelyaed, bool ignorePossiblyDelayed, bool ignoreOutOfSequence) |
Set a filter to discard messages. | |
virtual void | getMsgQualifierFilter (bool &ignoreDefinitelyDuplicate, bool &ignorePossiblyDuplicate, bool &ignoreDefinitelyDelyaed, bool &ignorePossiblyDelayed, bool &ignoreOutOfSequence) const |
Get the filters that discard message according to the message qualifier. | |
virtual void | destroy () |
Destroy the subscription. | |
virtual void | destroyEx () |
This function will destroy the subscription and can be called from any thread. | |
![]() | |
virtual | ~MamaBasicSubscription () |
The destructor will call destroy() if the subscription has not already been destroyed. | |
MamaBasicSubscription (void) | |
Constructor. | |
virtual void | createBasic (MamaTransport *transport, MamaQueue *queue, MamaBasicSubscriptionCallback *callback, const char *topic, void *closure=NULL) |
Create a basic subscription without market data semantics. | |
virtual bool | isActive (void) const |
Return whether the subscription is active. | |
virtual const char * | getTopic (void) const |
Return the symbol for this subscription. | |
virtual MamaTransport * | getTransport (void) const |
Return the MamaTransport for this subscription. | |
virtual MamaBasicSubscriptionCallback * | getBasicCallback (void) const |
Return the MamaSubscriptionCallback for this subscription. | |
virtual MamaQueue * | getQueue (void) const |
Return the MamaQueue for the subscription. | |
virtual void | setClosure (void *closure) |
Set the closure for the subscription. | |
virtual void * | getClosure (void) const |
Return the closure for the subscription. | |
virtual void | setDebugLevel (MamaLogLevel level) |
Set the debug level for this subscription. | |
virtual MamaLogLevel | getDebugLevel () const |
Return the debug level for this subscription. | |
virtual bool | checkDebugLevel (MamaLogLevel level) const |
Return whether the debug level for this subscription equals or exceeds some level. | |
virtual mamaSubscriptionState | getState (void) |
This function will return the current state of the subscription, this function should be used in preference to the mamaSubscription_isActive or mamaSubscription_isValid functions. |
Additional Inherited Members | |
![]() | |
void * | mClosure |
MamaQueue * | mQueue |
mamaSubscription | mSubscription |
MamaTransport * | mTransport |
The MamaSubscription
interface represents a subscription to a topic.
It provides transparent market data semantics and functionality including initial value requests, recap requests, subscription management and data quality.
|
virtual |
Wombat::MamaSubscription::MamaSubscription | ( | void | ) |
|
virtual |
|
virtual |
|
virtual |
Set up a subscription.
callback | The callback. |
transport | The transport. |
queue | The mama queue. |
source | The data source name for the listener. |
symbol | The symbol for the listener. |
closure | The caller supplied closure. |
|
virtual |
Set up a subscription.
queue | The mama queue. |
callback | The callback. |
source | The MamaSource identifying the publisher for this symbol. |
symbol | The symbol for the listener. |
closure | The caller supplied closure. |
|
virtual |
Activate a subscriber using the throttle queue.
This method places a request to create a subscriber on the throttle queue which dispatches tasks that produce messages at a controlled rate. The rate is determined by the outbound throttle rate of the underlying MamaTransport
.
In the event that listener creation fails as the result of an messaging related error the callback is invoked with information regarding the error.
If entitlements are enabled, and the caller is not entitled to the requested symbol, the first invocation of the callback will invoked with status "MamaMsgStatus.NOT_ENTITLED".
As an added convenience, callers may implement the onComplete
and onError
members of MamaSubscriptionCallback
. onComplete
is invoked prior to the arrival of any initial message signalling the successful creation of the listener. onError
is invoked if a TIBRV or entitlement error occurs prior to listener creation.
It is also possible for an entitlement error to occur after a listener is created. This occurs when the entitlement information is included in the initial message sent by the feed handler as is often the case.
If an error occurs during listener creation. destroy
is called automatically.
|
virtual |
Deactivate a subscriber.
The subscription can be reactivated using activate().
|
virtual |
Set up and activate a subscriber using the throttle queue.
This method is equivalent to calling setup() followed by activate().
transport | The transport. |
queue | The mama queue. |
callback | The callback. |
source | The data source name for the listener. |
symbol | The symbol for the listener. |
closure | The caller supplied closure. |
|
virtual |
Set up and activate a subscriber using the throttle queue.
This method is equivalent to calling setup() followed by activate().
queue | The mama queue. |
callback | The callback. |
source | The MamaSource identifying the publisher for this symbol. |
symbol | The symbol for the listener. |
closure | The caller supplied closure. |
|
virtual |
Set up and activate a snapshot subscriber using the throttle queue.
This method is equivalent to calling setup() followed by setServiceLevel(MAMA_SERVICE_LEVEL_SNAPSHOT,0) followed by activate().
transport | The transport. |
queue | The mama queue. |
callback | The callback. |
source | The data source name for the listener. |
symbol | The symbol for the listener. |
closure | The caller supplied closure. |
|
virtual |
Determines whether the subscription requires an initial value.
Must be set before calling createXXX(). Default is true. Not applicable for snapshot subscriptions as they simply request an initial value.
requiresInitial | True if an initial value is required |
|
virtual |
Return true if the subscription requires an initial value.
|
virtual |
Return true if the subscription has received an initial.
|
virtual |
Set the number of retries for initial value requests and recap requests.
This must called before createXXX() to affect the initial value requests. Calling it after createXXX() only affects recap requests. The default is MAMA_DEFAULT_RETRIES.
retries | The number of time to retry the initial value request. |
|
virtual |
Return the retries.
|
virtual |
Set the subscription type.
The default is normal.
type | The type of subscription (normal, group, order book, etc.). |
|
virtual |
Return the subscription type.
|
virtual |
Return the service level option.
|
virtual |
Set the service level.
This method must be invoked before createXXX().
svcLevel | The service level of the subscription (real time, snapshot, etc.). The default is real time. |
svcLevelOpt | An optional argument for certain service levels. |
|
virtual |
Return the service level.
|
virtual |
Return the symbol for this subscription.
|
virtual |
|
virtual |
Sets the symbol for this subscription.
Should generally only be used for updating symbology mappings.
|
virtual |
Return the (subscription-specific) MAMA source derivative for this subscription.
|
virtual |
Return the (subscription-specific) MAMA source derivative for this subscription.
|
virtual |
Return the MAMA source for this subscription.
|
virtual |
Return the source for this subscription.
|
virtual |
Set the timeout for this subscription.
The timeout is used for requesting initial values, and recaps.
timeout | The timeout in seconds. |
|
virtual |
Return the timeout.
|
virtual |
Attempt to recover from sequence number gaps by requesting a recap.
recover | true enables recovery attempts. |
|
virtual |
Returns true if listener is configure to recover from sequence number gaps by requesting a recap.
|
virtual |
Set the application data type.
The default is 0.
dataType | The application-specific data type (e.g., market data). |
|
virtual |
Get the application data type.
The default is 0.
|
virtual |
Set a hint to the size of groups when making group subscriptions.
groupSizeHint | Approximate expected group size |
|
virtual |
Set the item closure for group subscriptions.
Group subscriptions receive updates for multiple symbols. This method allows calls to set a per-symbol closure which will be passed as the fourth argument to subsequent calls to the onMsg callback. This method may only be called during the onMsg callback.
Setting the item closure for a non-group subscription provides a second closure.
|
virtual |
Get the item closure for group subscriptions.
See setItemClosure. When invoked during an onMsg callback this method returns the closure for the current item in a group subscription. When invoked outside an onMsg callback, it returns the closure from the most recent callback.
|
virtual |
Set the number of messages to cache for each symbol before the initial value arrives.
This allows the subscription to recover when the initial value arrives late (after a subsequent trade or quote already arrived).
For group subscription, a separate cache is used for each group member.
The default is 10.
cacheSize | The size of the cache. |
|
virtual |
Return the initial value cache size.
|
virtual |
Set a filter to discard messages.
ignoreDefinitelyDuplicate | If true callbacks will not be invoked for messages where MamaMsg::getIsDefinitelyDuplicate returns true. |
ignorePossiblyDuplicate | If true callbacks will not be invoked for messages where MamaMsg::getIsPossiblyDuplicate returns true. |
ignoreDefinitelyDelyaed | If true callbacks will not be invoked for messages where MamaMsg::getIsDefinitelyDelayed returns true. |
ignorePossiblyDelayed | If true callbacks will not be invoked for messages where MamaMsg::getIsPossiblyDelayed returns true. |
ignoreOutOfSequence | If true callbacks will not be invoked for messages where MamaMsg::getIsOutOfSequence returns true. |
|
virtual |
Get the filters that discard message according to the message qualifier.
ignoreDefinitelyDuplicate | If true callbacks will not be invoked for messages where MamaMsg::getIsDefinitelyDuplicate returns true. |
ignorePossiblyDuplicate | If true callbacks will not be invoked for messages where MamaMsg::getIsPossiblyDuplicate returns true. |
ignoreDefinitelyDelayed | If true callbacks will not be invoked for messages where MamaMsg::getIsDefinitelyDelayed returns true. |
ignorePossiblyDelayed | If true callbacks will not be invoked for messages where MamaMsg::getIsPossiblyDelayed returns true. |
ignoreOutOfSequence | If true callbacks will not be invoked for messages where MamaMsg::getIsOutOfSequence returns true. |
|
virtual |
Destroy the subscription.
Destroys the underlying subscription. The subscription can be recreated via a subsequent call to create()
Reimplemented from Wombat::MamaBasicSubscription.
|
virtual |
This function will destroy the subscription and can be called from any thread.
Note that the subscription will not be fully destroyed until the onDestroy callback is received from the MamaBasicSubscriptionCallback interface. To destroy from the dispatching thread the destroy function should be used in preference.
Reimplemented from Wombat::MamaBasicSubscription.