A MamdaSubscription is used to register interest in a particular symbol and source. More...
#include <MamdaSubscription.h>
Public Member Functions | |
MamdaSubscription () | |
Default constructor. | |
virtual | ~MamdaSubscription () |
Destructor. | |
virtual MamdaSubscription * | clone () const |
Clone this MamdaSubscription. | |
void | create (MamaQueue *queue, MamaSource *source, const char *symbol, void *closure=NULL) |
Create and activate a subscription. | |
void | destroy () |
Destroy a subscription. | |
bool | isActive () const |
Return whether subscription is active. | |
void | setSource (MamaSource *source) |
Set the data source name. | |
void | setSymbol (const char *symbol) |
Set the symbol. | |
void | setQueue (MamaQueue *queue) |
Set the MAMA queue. | |
void | setMdDataType (mamaMdDataType mdDataType) |
Set the market data type. | |
void | setType (mamaSubscriptionType type) |
Set the subscription type. | |
void | setServiceLevel (mamaServiceLevel serviceLevel, long serviceLevelOpt=0) |
Set the MAMA service level. | |
void | setRequireInitial (bool require) |
Set whether an initial value is required. | |
void | setTimeout (double timeout) |
Set the subscription timeout (in seconds). | |
void | setRetries (int retries) |
Set the subscription retries. | |
void | setClosure (void *closure) |
Set the closure. | |
void | setGroupSizeHint (int groupSizeHint) |
Set the group size hint. | |
void | setMamaSubscription (MamaSubscription *subscription) |
Set the MamaSubscription. | |
void | addMsgListener (MamdaMsgListener *listener) |
Add a listener for regular messages. | |
void | addQualityListener (MamdaQualityListener *listener) |
Add a listener for changes in quality status. | |
void | addErrorListener (MamdaErrorListener *listener) |
Add a listener for error events. | |
std::vector< MamdaMsgListener * > & | getMsgListeners () |
Return the vector of message listeners. | |
void | activate () |
Activate the subscription. | |
void | deactivate () |
Deactivate the subscription. | |
void | requestRecap () |
Deprecated. | |
MamaSource * | getSource () const |
Return the source. | |
const char * | getSourceName () const |
Return the publisher source name. | |
const char * | getSymbol () const |
Return the symbol. | |
const char * | getExchange () const |
Return the exchange. | |
MamaTransport * | getTransport () const |
Return the transport. | |
MamaQueue * | getQueue () const |
Return the queue. | |
MamaSubscription * | getMamaSubscription () |
Return the MamaSubscription object. | |
mamaSubscriptionType | getType () const |
Return the subscription type. | |
mamaServiceLevel | getServiceLevel () const |
Return the service level. | |
long | getServiceLevelOpt () const |
Return the service level option. | |
bool | getRequireInitial () const |
Return whether an initial is required. | |
double | getTimeout () const |
Return the timeout (seconds). | |
int | getRetries () const |
Return the retries. | |
void * | getClosure () const |
Get the additional object passed as the closure to the create() method. | |
uint32_t | getSeqNum () const |
Get the message-level sequence number. | |
void | setItemClosure (void *closure) |
Set the item closure for group subscriptions. | |
void * | getItemClosure (void) |
Get the item closure for group subscriptions. | |
bool | checkDebugLevel (MamaLogLevel level) const |
Return whether the debug level for this subscription equals or exceeds some level. |
A MamdaSubscription is used to register interest in a particular symbol and source.
A MamaSource object is required to actually activate the subscription.
Multiple listeners can be added to the MamdaSubscription. In this way, an application can make use of more than one of the specialized value added MAMDA listeners, such as MamdaTradeListener and MamdaQuoteListener.
The queue argument may be null to use Mama's internal queue.
Wombat::MamdaSubscription::MamdaSubscription | ( | ) |
Default constructor.
Use the create() method to create and activate the subscription.
|
virtual |
Destructor.
|
virtual |
Clone this MamdaSubscription.
Allocate an inactive MamdaSubscription object that is initialized as a duplicate of this one. The purpose of this facility is to enable a "template" of a MamdaSubscription for use with many subscriptions. The following subscription attributes are copied: source, symbol, queue, subscription type, service level, requires initial and timeout.
void Wombat::MamdaSubscription::create | ( | MamaQueue * | queue, |
MamaSource * | source, | ||
const char * | symbol, | ||
void * | closure = NULL |
||
) |
Create and activate a subscription.
Set any subscription properties prior to calling this method.
void Wombat::MamdaSubscription::destroy | ( | ) |
Destroy a subscription.
bool Wombat::MamdaSubscription::isActive | ( | ) | const |
Return whether subscription is active.
void Wombat::MamdaSubscription::setSource | ( | MamaSource * | source | ) |
Set the data source name.
Do this before calling activate().
void Wombat::MamdaSubscription::setSymbol | ( | const char * | symbol | ) |
Set the symbol.
Do this before calling activate().
void Wombat::MamdaSubscription::setQueue | ( | MamaQueue * | queue | ) |
Set the MAMA queue.
Do this before calling activate().
void Wombat::MamdaSubscription::setMdDataType | ( | mamaMdDataType | mdDataType | ) |
Set the market data type.
Do this before calling activate().
void Wombat::MamdaSubscription::setType | ( | mamaSubscriptionType | type | ) |
Set the subscription type.
Do this before calling activate().
void Wombat::MamdaSubscription::setServiceLevel | ( | mamaServiceLevel | serviceLevel, |
long | serviceLevelOpt = 0 |
||
) |
Set the MAMA service level.
void Wombat::MamdaSubscription::setRequireInitial | ( | bool | require | ) |
Set whether an initial value is required.
Do this before calling activate().
void Wombat::MamdaSubscription::setTimeout | ( | double | timeout | ) |
Set the subscription timeout (in seconds).
Do this before calling activate().
void Wombat::MamdaSubscription::setRetries | ( | int | retries | ) |
Set the subscription retries.
Do this before calling activate().
void Wombat::MamdaSubscription::setClosure | ( | void * | closure | ) |
Set the closure.
Do this before calling activate().
void Wombat::MamdaSubscription::setGroupSizeHint | ( | int | groupSizeHint | ) |
Set the group size hint.
Do this before calling activate().
void Wombat::MamdaSubscription::setMamaSubscription | ( | MamaSubscription * | subscription | ) |
Set the MamaSubscription.
This is normally done automatically.
void Wombat::MamdaSubscription::addMsgListener | ( | MamdaMsgListener * | listener | ) |
Add a listener for regular messages.
void Wombat::MamdaSubscription::addQualityListener | ( | MamdaQualityListener * | listener | ) |
Add a listener for changes in quality status.
void Wombat::MamdaSubscription::addErrorListener | ( | MamdaErrorListener * | listener | ) |
Add a listener for error events.
std::vector<MamdaMsgListener*>& Wombat::MamdaSubscription::getMsgListeners | ( | ) |
Return the vector of message listeners.
void Wombat::MamdaSubscription::activate | ( | ) |
Activate the subscription.
Until this method is invoked, no updates will be received. The parameters for the subscription should have been specified using the "set" methods.
void Wombat::MamdaSubscription::deactivate | ( | ) |
Deactivate the subscription.
No more updates will be received for this subscription (unless activate() is invoked again).
This function must be called from the same thread dispatching on the associated event queue unless both the default queue and dispatch queue are not actively dispatching.
void Wombat::MamdaSubscription::requestRecap | ( | ) |
Deprecated.
This method is now a no-op.
MamaSource* Wombat::MamdaSubscription::getSource | ( | ) | const |
Return the source.
Note: When using managed subscriptions this currently returns NULL
const char* Wombat::MamdaSubscription::getSourceName | ( | ) | const |
Return the publisher source name.
const char* Wombat::MamdaSubscription::getSymbol | ( | ) | const |
Return the symbol.
const char* Wombat::MamdaSubscription::getExchange | ( | ) | const |
Return the exchange.
MamaTransport* Wombat::MamdaSubscription::getTransport | ( | ) | const |
Return the transport.
MamaQueue* Wombat::MamdaSubscription::getQueue | ( | ) | const |
Return the queue.
MamaSubscription* Wombat::MamdaSubscription::getMamaSubscription | ( | ) |
Return the MamaSubscription object.
mamaSubscriptionType Wombat::MamdaSubscription::getType | ( | ) | const |
Return the subscription type.
mamaServiceLevel Wombat::MamdaSubscription::getServiceLevel | ( | ) | const |
Return the service level.
long Wombat::MamdaSubscription::getServiceLevelOpt | ( | ) | const |
Return the service level option.
bool Wombat::MamdaSubscription::getRequireInitial | ( | ) | const |
Return whether an initial is required.
double Wombat::MamdaSubscription::getTimeout | ( | ) | const |
Return the timeout (seconds).
int Wombat::MamdaSubscription::getRetries | ( | ) | const |
Return the retries.
void* Wombat::MamdaSubscription::getClosure | ( | ) | const |
Get the additional object passed as the closure to the create() method.
uint32_t Wombat::MamdaSubscription::getSeqNum | ( | ) | const |
Get the message-level sequence number.
This number is normally sequential although there are some exceptions. Erroneous exceptions are reported via the "quality listener" interface.
void Wombat::MamdaSubscription::setItemClosure | ( | void * | closure | ) |
Set the item closure for group subscriptions.
Setting the item closure for a non-group subscription provides a second closure.
void* Wombat::MamdaSubscription::getItemClosure | ( | void | ) |
Get the item closure for group subscriptions.
bool Wombat::MamdaSubscription::checkDebugLevel | ( | MamaLogLevel | level | ) | const |
Return whether the debug level for this subscription equals or exceeds some level.
level | The debug level to check. |