OpenMAMA
MamdaSubscription.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 MamdaSubscriptionH
23 #define MamdaSubscriptionH
24 
25 #include <mamda/MamdaConfig.h>
26 #include <mama/mamacpp.h>
27 #include <mama/marketdata.h>
28 #include <mamda/MamdaFieldState.h>
29 
30 namespace Wombat
31 {
32 
33  class MamaSource;
34  class MamaTransport;
35  class MamaQueue;
36 
37  class MamdaMsgListener;
38  class MamdaQualityListener;
39  class MamdaErrorListener;
40 
54  class MAMDAExpDLL MamdaSubscription
55  {
56  public:
62 
66  virtual ~MamdaSubscription ();
67 
77  virtual MamdaSubscription* clone() const;
78 
83  void create (
84  MamaQueue* queue,
85  MamaSource* source,
86  const char* symbol,
87  void* closure = NULL);
88 
92  void destroy ();
93 
97  bool isActive () const;
98 
102  void setSource (MamaSource* source);
103 
107  void setSymbol (const char* symbol);
108 
112  void setQueue (MamaQueue* queue);
113 
117  void setMdDataType (mamaMdDataType mdDataType);
118 
122  void setType (mamaSubscriptionType type);
123 
127  void setServiceLevel (mamaServiceLevel serviceLevel,
128  long serviceLevelOpt = 0);
129 
134  void setRequireInitial (bool require);
135 
140  void setTimeout (double timeout);
141 
146  void setRetries (int retries);
147 
151  void setClosure (void* closure);
152 
156  void setGroupSizeHint (int groupSizeHint);
157 
161  void setMamaSubscription (MamaSubscription* subscription);
162 
166  void addMsgListener (MamdaMsgListener* listener);
167 
171  void addQualityListener (MamdaQualityListener* listener);
172 
176  void addErrorListener (MamdaErrorListener* listener);
177 
183  std::vector<MamdaMsgListener*>& getMsgListeners ();
184 
190  void activate ();
191 
200  void deactivate ();
201 
206  void requestRecap ();
207 
212  MamaSource* getSource() const;
213 
217  const char* getSourceName() const;
218 
222  const char* getSymbol() const;
223 
227  const char* getExchange() const;
228 
232  MamaTransport* getTransport() const;
233 
237  MamaQueue* getQueue() const;
238 
242  MamaSubscription* getMamaSubscription();
243 
247  mamaSubscriptionType getType() const;
248 
252  mamaServiceLevel getServiceLevel() const;
253 
257  long getServiceLevelOpt() const;
258 
262  bool getRequireInitial() const;
263 
267  double getTimeout() const;
268 
272  int getRetries() const;
273 
278  void* getClosure() const;
279 
285  uint32_t getSeqNum() const;
286 
293  void setItemClosure (void* closure);
294 
298  void* getItemClosure (void);
299 
308  bool checkDebugLevel (MamaLogLevel level) const;
309 
310  private:
311  struct MamdaSubscriptionImpl;
312  MamdaSubscriptionImpl& mImpl;
313  };
314 
315 } // namespace
316 
317 #endif // MamdaSubscriptionH


© 2012 Linux Foundation