OnixS C++ CME MDP Premium Market Data Handler  5.8.9
API Documentation
Handler.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <string>
24 #include <memory>
25 
28 
30 
31 ONIXS_CMEMDH_LTWT_CLASS_DECL(HandlerSettings);
32 ONIXS_CMEMDH_LTWT_CLASS_DECL(MemoryPoolSettings);
33 ONIXS_CMEMDH_LTWT_CLASS_DECL(InstrumentSelection);
34 
35 #if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
36 
37 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(HandlerListener);
38 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(ChannelFeedListener);
39 
40 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(MarketDataListener);
41 ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(SecurityListener);
42 
45 ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
46 
47 ONIXS_CMEMDH_LTWT_CLASS_DECL(SessionSettings);
48 
49 #endif // ONIXS_CMEMDH_NO_DEPRECATED
50 
52 
53 /// Encapsulates all the machinery related with market
54 /// data processing from CME Market Data Platform.
56 {
57 public:
58  /// Initializes the instance with the default settings.
59  Handler(const std::string& = ONIXS_CMEMDH_COMPILER_INFO);
60 
61  /// Initializes instance with the memory pool
62  /// configured according to the given settings.
63  explicit Handler(const MemoryPoolSettings&, const std::string& = ONIXS_CMEMDH_COMPILER_INFO);
64 
65  /// Initializes the instance according to the given settings.
66  explicit Handler(const HandlerSettings&, const std::string& = ONIXS_CMEMDH_COMPILER_INFO);
67 
68  /// Finalizes the instance.
69  ~Handler();
70 
71  /// The configuration parameters of the given instance.
72  HandlerSettings& settings();
73 
74  /// Immutable configuration of the given instance.
75  const HandlerSettings& settings() const;
76 
77 #if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
78 
79  /// Logger currently used by the Handler.
80  ///
81  /// @warning The given member is deprecated.
82  /// Use settings().logging().logger() member
83  /// to access the Logger instance used by the
84  /// Handler while logging its events.
85  Logger& logger();
86 
87 #endif // ONIXS_CMEMDH_NO_DEPRECATED
88 
89  /// Filters instruments whose market data
90  /// is to be processed and events are to be
91  /// fired by the Handler.
92  ///
93  /// @warning Instrument selection can be
94  /// updated only when market data processing
95  /// is not performed by the Handler or upon
96  /// successful instrument recovery completion.
97  void selectInstruments(const InstrumentSelection&);
98 
99  /// Erases instrument definitions cache if used.
100  /// Handler will produce a new cache at next start.
101  void clearInstrumentCache();
102 
103 #if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
104 
105  /// Registers Handler events listener.
106  ///
107  /// Only single instance of listener can be
108  /// associated with the Handler. Registering
109  /// new listener removes previous one. Listener
110  /// instance lifetime shall be not less than
111  /// Handler's one.
112  ///
113  /// Listeners are to be associated before
114  /// starting market data processing - Handler
115  /// must be in stopped state.
116  ///
117  /// @throw std::exception in case when
118  /// handler is not in configurable state.
119  ///
120  /// @warning The given member is deprecated.
121  /// Use settings().listeners().handler() member
122  /// to assign the listener for the desired events.
123  void registerListener(HandlerListener& listener);
124 
125  /// Registers feed event listener.
126  ///
127  /// Only single instance of listener can be
128  /// associated with the Handler. Registering
129  /// new listener removes previous one. Listener
130  /// instance lifetime shall be not less than
131  /// Handler's one.
132  ///
133  /// Listeners are to be associated before
134  /// starting market data processing - Handler
135  /// must be in stopped state.
136  ///
137  /// @throw std::exception in case when
138  /// handler is not in configurable state.
139  ///
140  /// @warning The given member is deprecated.
141  /// Use settings().listeners().feeds() member
142  /// to assign the listener for the desired events.
143  void registerFeedListener(ChannelFeedListener& listener);
144 
145  /// Registers market data processing listener.
146  ///
147  /// Only single instance of listener can be
148  /// associated with the Handler. Registering
149  /// new listener removes previous one. Listener
150  /// instance lifetime shall be not less than
151  /// Handler's one.
152  ///
153  /// Listeners are to be associated before
154  /// starting market data processing - Handler
155  /// must be in stopped state.
156  ///
157  /// @throw std::exception in case when
158  /// handler is not in configurable state.
159  ///
160  /// @warning The given member is deprecated.
161  /// Use settings().listeners().marketData() member
162  /// to assign the listener for the desired events.
163  void registerMarketDataListener(MarketDataListener& listener);
164 
165  /// Registers security events listener.
166  ///
167  /// Only single instance of listener can be
168  /// associated with the Handler. Registering
169  /// new listener removes previous one. Listener
170  /// instance lifetime shall be not less than
171  /// Handler's one.
172  ///
173  /// Listeners are to be associated before
174  /// starting market data processing - Handler
175  /// must be in stopped state.
176  ///
177  /// @throw std::exception in case when
178  /// handler is not in configurable state.
179  ///
180  /// @warning The given member is deprecated.
181  /// Use settings().listeners().security() member
182  /// to assign the listener for the desired events.
183  void registerSecurityListener(SecurityListener& listener);
184 
185  /// Binds Feed Engine to the Handler.
186  ///
187  /// Handler must be in stopped state.
188  ///
189  /// @throw std::exception in case when
190  /// handler is not in configurable state.
191  ///
192  /// @warning The given member is deprecated.
193  /// Use settings().feeds().engine() member to
194  /// assign the feed engine used by the Handler
195  /// while manipulating the feeds.
196  void bindFeedEngine(NetFeedEngine& feedEngine);
197 
198  /// Binds TCP Recovery Service to the Handler.
199  ///
200  /// Handler must be in stopped state.
201  ///
202  /// @throw std::exception in case when
203  /// handler is not in configurable state.
204  ///
205  /// @warning The given member is deprecated.
206  /// Use settings().session().tcpRecovery().service()
207  /// member to assign the TCP recovery service used by
208  /// the Handler to request missing packets.
209  void bindTcpRecovery(TcpRecoveryService& tcpRecovery);
210 
211  /// Binds Logging Service to the Handler.
212  ///
213  /// Handler must be in stopped state.
214  ///
215  /// @throw std::exception in case when
216  /// handler is not in configurable state.
217  ///
218  /// @warning The given member is deprecated.
219  /// Use settings().logging().logger() member
220  /// to assign the Logger instance used by the
221  /// Handler to log various events.
222  void bindLogger(Logger& logger);
223 
224 #endif // ONIXS_CMEMDH_NO_DEPRECATED
225 
226  /// Starts market data processing.
227  void start();
228 
229 #if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
230 
231  /// Updates the session configuration
232  /// according to the given settings and
233  /// starts market data processing.
234  ///
235  /// @warning The given member is deprecated.
236  /// Use settings().session() member to update
237  /// session-related configuration and start()
238  /// member to launch market data processing.
239  void start(const SessionSettings&);
240 
241 #endif // ONIXS_CMEMDH_NO_DEPRECATED
242 
243  /// Stops market data processing.
244  void stop();
245 
246  /// Returns the license expiration date.
247  std::string licenseExpirationDate() const;
248 
249 private:
250  friend ONIXS_CMEMDH_LTWT_CLASS_DECL(PcapReplayHelper);
251 
252  // Data processing workhorse.
253  ChannelModel* model_;
254 
255  // Coping is not allowed for the instances.
256 
257  Handler(const Handler&);
258  Handler& operator=(const Handler&);
259 };
260 
Handler&#39;s configuration settings.
Encapsulates all the machinery related with market data processing from CME Market Data Platform...
Definition: Handler.h:55
Represents selection of instruments whose market data is to be processed by the Handler.
Definition: Filtering.h:31
Callbacks invoked by Handler during market data processing to reflect various stages of processing...
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:35
Abstraction for the Feed Engine machinery.
Definition: FeedEngine.h:101
Callbacks invoked by Handler to expose market data entities.
A listener for the feed-related events in the bounds of a single Handler instance.
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
Basic set of parameters affecting behavior of the Handler when the market data processing is performe...
#define ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:36
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:48
Abstraction of logger.
Definition: Logger.h:155
#define ONIXS_CMEMDH_COMPILER_INFO
Definition: CompilerInfo.h:35
#define ONIXS_CMEMDH_INTERNAL_CLASS_DECL(typeName)
Definition: Bootstrap.h:37
Events raised by Handler while processing market data.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68