OpenMAMA C++ API
MamaSubscription.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MAMA_SUBSCRIPTION_CPP_H__
23 #define MAMA_SUBSCRIPTION_CPP_H__
24 
26 #include "mama/subscription.h"
27 
28 namespace Wombat
29 {
30  class MamaSubscriptionCallback;
31  class MamaSource;
32  class MamaSourceDerivative;
33 
34  struct MamaSubscriptionImpl;
43  class MAMACPPExpDLL MamaSubscription : public MamaBasicSubscription
44  {
45  public:
46  virtual ~MamaSubscription ();
47 
48  /* Construct a MamaSubscription. MamaSubscription::createXXX() must be
49  * called to activate the subscription.
50  */
51  MamaSubscription (void);
52 
53  virtual void setCSubscription (mamaSubscription subscription);
54  virtual mamaSubscription getCSubscription ();
55 
66  virtual void setup (MamaTransport* transport,
67  MamaQueue* queue,
68  MamaSubscriptionCallback* callback,
69  const char* source,
70  const char* symbol,
71  void* closure = NULL);
72 
83  virtual void setup (MamaQueue* queue,
84  MamaSubscriptionCallback* callback,
85  MamaSource* source,
86  const char* symbol,
87  void* closure = NULL);
88 
120  virtual void activate ();
121 
126  virtual void deactivate ();
127 
128 
140  virtual void create (MamaTransport* transport,
141  MamaQueue* queue,
142  MamaSubscriptionCallback* callback,
143  const char* source,
144  const char* symbol,
145  void* closure = NULL);
146 
158  virtual void create (MamaQueue* queue,
159  MamaSubscriptionCallback* callback,
160  MamaSource* source,
161  const char* symbol,
162  void* closure = NULL);
163 
177  virtual void createSnapshot (MamaTransport* transport,
178  MamaQueue* queue,
179  MamaSubscriptionCallback* callback,
180  const char* source,
181  const char* symbol,
182  void* closure = NULL);
183 
191  virtual void setRequiresInitial (bool requiresInitial);
192 
196  virtual bool getRequiresInitial (void);
197 
201  virtual bool getReceivedInitial (void);
202 
211  virtual void setRetries (int retries);
212 
216  virtual int getRetries (void);
217 
223  virtual void setSubscriptionType (mamaSubscriptionType type);
224 
228  virtual mamaSubscriptionType getSubscriptionType (void);
229 
233  virtual long getServiceLevelOpt (void);
234 
242  virtual void setServiceLevel (mamaServiceLevel svcLevel,
243  long svcLevelOpt);
244 
248  virtual mamaServiceLevel getServiceLevel (void);
249 
255  virtual const char* getSymbol (void) const;
256 
257  virtual MamaSubscriptionCallback* getCallback (void) const;
258 
263  virtual void setSymbol (const char* symbol);
264 
271  virtual const MamaSourceDerivative* getSourceDerivative (void) const;
272 
279  virtual MamaSourceDerivative* getSourceDerivative (void);
280 
286  virtual const MamaSource* getSource (void) const;
287 
293  virtual const char* getSubscSource (void) const;
294 
301  virtual void setTimeout (double timeout);
302 
306  virtual double getTimeout (void);
307 
314  virtual void setRecapTimeout (double timeout);
315 
319  virtual double getRecapTimeout (void);
320 
327  virtual void setRecoverGaps (bool recover);
328 
335  virtual bool getRecoverGaps (void) const;
336 
342  virtual void setAppDataType (uint8_t dataType);
343 
349  virtual uint8_t getAppDataType () const;
350 
356  virtual void setGroupSizeHint (int groupSizeHint);
357 
370  virtual void setItemClosure (void* closure);
371 
379  virtual void* getItemClosure (void);
380 
392  virtual void setPreInitialCacheSize (int cacheSize);
393 
399  virtual int getPreInitialCacheSize (void);
400 
419  virtual void setMsgQualifierFilter (bool ignoreDefinitelyDuplicate,
420  bool ignorePossiblyDuplicate,
421  bool ignoreDefinitelyDelyaed,
422  bool ignorePossiblyDelayed,
423  bool ignoreOutOfSequence);
424 
444  virtual void getMsgQualifierFilter (bool &ignoreDefinitelyDuplicate,
445  bool &ignorePossiblyDuplicate,
446  bool &ignoreDefinitelyDelyaed,
447  bool &ignorePossiblyDelayed,
448  bool &ignoreOutOfSequence) const;
449 
456  virtual void destroy ();
457 
467  virtual void destroyEx();
468 
469  private:
470 
471  /* Private functions. */
472  static void MAMACALLTYPE onSubscriptionCreate (mamaSubscription subscription,
473  void *closure);
474 
475  static void MAMACALLTYPE onSubscriptionDestroy (mamaSubscription subscription,
476  void *closure);
477 
478  static void MAMACALLTYPE onSubscriptionError (mamaSubscription subscription,
479  mama_status status,
480  void *platformError,
481  const char *subject,
482  void *closure);
483 
484  static void MAMACALLTYPE onSubscriptionGap (mamaSubscription subscription,
485  void* closure);
486 
487  static void MAMACALLTYPE onSubscriptionMessage (mamaSubscription subscription,
488  mamaMsg msg,
489  void *closure,
490  void *topicClosure);
491 
492  static void MAMACALLTYPE onSubscriptionQuality (mamaSubscription subscription,
493  mamaQuality quality,
494  const char *symbol,
495  short cause,
496  const void *platformInfo,
497  void *closure);
498 
499  static void MAMACALLTYPE onSubscriptionRecapRequest (mamaSubscription subscription,
500  void* closure);
501 
502  // The callback class passed to the create function
503  MamaSubscriptionCallback *mCallback;
504 
505  // The source derivative
506  MamaSourceDerivative *mSourceDeriv;
507  MamaSubscriptionImpl *mImpl;
508  };
509 
510 } // namespace Wombat
511 #endif // MAMA_SUBSCRIPTION_CPP_H__
A MAMA source maintains information about a data source, including the quality of the data coming fro...
Definition: MamaSource.h:55
The MamaBasicSubscription interface represents a subscription to a topic with no market data semantic...
Definition: MamaBasicSubscription.h:44
A MamaSourceDerivative provides a reference to a common MamaSource object but can have attributes (su...
Definition: MamaSourceDerivative.h:38
Definition: MamaConnection.h:29
The message callback interface.
Definition: MamaSubscriptionCallback.h:39
Queue allows applications to dispatch events in order with multiple threads using a single MamaDispat...
Definition: MamaQueue.h:40
The MamaTransport class provides market data functionality.
Definition: MamaTransport.h:261
The MamaSubscription interface represents a subscription to a topic.
Definition: MamaSubscription.h:43