OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
HandlerListener.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 
26 
28 
29 /// Collection of statuses of recovery completion.
31 {
32  enum Enum
33  {
34  /// Recovery accomplished successfully.
36 
37  /// Recovery failed and no further
38  /// attempts to recover will be made.
40 
41  /// Identifies incomplete recovery.
42  /// Used to identify restart of recovery,
43  /// when new loop of recovery data is detected
44  /// and thus recovery must be done from scratch.
45  Incomplete
46  };
47 };
48 
49 /// Gathers information about the recovery completion.
51 {
52 public:
53  /// Initializes as blank instance.
55  {
56  }
57 
58  /// Initializes with given details.
61  const std::string& message = std::string())
62  : status_(status), message_(message)
63  {
64  }
65 
66  /// Indicates completion status of the recovery.
68  {
69  return status_;
70  }
71 
72  /// Assigns completion status of the recovery.
73  void
76  {
77  status_ = status;
78  }
79 
80  /// Human readable description of recovery completion.
81  /// In case of failure may include failure reason.
82  const std::string& details() const
83  {
84  return message_;
85  }
86 
87  /// Associates human readable message
88  /// with recover completion event.
89  void
91  const std::string& message)
92  {
93  message_ = message;
94  }
95 
96 private:
98  std::string message_;
99 };
100 
101 /// Collection of issues Handler may
102 /// report during market data processing.
104 Issue
105 {
106  enum Enum
107  {
108  /// Identifies network connection failure.
110 
111  /// Source reported this issue will
112  /// function in reduced capacity.
113  ///
114  /// For example, if feed engine fails to
115  /// configure feed to use socket buffer as
116  /// specified by Handler settings, feed will
117  /// continue functioning but in reduced capacity.
119 
120  /// Indicates data reception failure.
122 
123  /// Indicates data receive timeout.
125 
126  /// Indicates data processing failure.
128 
129  /// Indicates internal queue overflow.
131 
132  /// Indicates error in data sequence.
134 
135  /// Operation performed by the Handler failed.
137 
138  /// Market data replay failed.
139  ReplayFailure
140  };
141 };
142 
143 /// Gathers information about the issue Handler
144 /// may experience while processing market data.
146 IssueArgs
147 {
148  Issue::Enum id_;
149  const std::string& source_;
150  const std::string& description_;
151 
152  IssueArgs(const IssueArgs&);
153  IssueArgs& operator =(const IssueArgs&);
154 
155 public:
156  /// Initializes issue with provided attributes.
158  Issue::Enum id,
159  const std::string& source,
160  const std::string& description)
161  : id_(id)
162  , source_(source)
163  , description_(description)
164  {
165  }
166 
167  /// Issue identifier.
168  Issue::Enum id() const
169  {
170  return id_;
171  }
172 
173  /// Source of the issue.
174  const std::string& source() const
175  {
176  return source_;
177  }
178 
179  /// Human readable description of the issue.
180  const std::string& description() const
181  {
182  return description_;
183  }
184 };
185 
186 /// Warning arguments.
187 typedef
188 IssueArgs
190 
191 /// Error arguments.
192 typedef
193 IssueArgs
195 
197 
198 /// Events raised by Handler while processing market data.
201 {
202  /// Handler is has started to process market data.
203  virtual
204  void
206  {
207  }
208 
209  /// Invoked when Handler has stopped market data processing.
210  virtual
211  void
213  {
214  }
215 
216  /// Download or replay of Security Definition(d) messages is started.
217  virtual
218  void
220  {
221  }
222 
223  /// Download or replay of Security Definition(d) messages is finished.
224  virtual
225  void
227  Handler&,
228  const RecoveryCompletionArgs&)
229  {
230  }
231 
232  /// Handler started recovering order books from snapshots.
233  ///
234  /// Handler switches to this state when it joins the market and the
235  /// initial books state is built from MarketDataSnapshotFullRefresh
236  /// (MsgType=W) messages or when the TCP Recovery is not used and the
237  /// message sequence number gap is detected, so the book state should
238  /// be re-built from MarketDataSnapshotFullRefresh (MsgType=W) messages
239  /// again.
240  ///
241  /// It should be assumed at this point that all books maintained
242  /// in the Handler may no longer have the correct, latest state
243  /// maintained by CME, so they are cleared.
244  virtual
245  void
247  {
248  }
249 
250  /// Handler accomplished recovering order books from snapshots.
251  ///
252  /// Handler switches to this state when the latest books state is
253  /// restored from MarketDataSnapshotFullRefresh (MsgType=W) messages
254  /// (all snapshot data is retrieved).
255  ///
256  /// It should be assumed at this point that all books maintained in
257  /// the Handler have the correct, latest state maintained by CME.
258  virtual
259  void
261  Handler&,
262  const RecoveryCompletionArgs&)
263  {
264  }
265 
266  /// Handler spawned recovery of lost packets over TCP feed.
267  virtual
268  void
270  {
271  }
272 
273  /// Handler accomplished recovery of lost packets over TCP feed.
274  virtual
275  void
277  Handler&,
278  const RecoveryCompletionArgs&)
279  {
280  }
281 
282  /// Handler resumed real-time processing of
283  /// market data received over incremental feeds.
284  virtual
285  void
287  {
288  }
289 
290  /// Handler suspended real-time processing of
291  /// market data received over incremental feeds.
292  virtual
293  void
295  {
296  }
297 
298  /// Non-critical issue occurred while Handler is
299  /// processing market data. Handler will handle
300  /// an issue by itself, thus no special handling
301  /// is required for the case. Supplied parameters
302  /// exposes details information on the issue.
303  virtual
304  void
306  Handler&,
307  const WarningArgs&)
308  {
309  }
310 
311  /// Error occurred while Handler is processing market
312  /// data. In contrast to warnings, given issue indicates
313  /// the fact Handler fell into a conditions which are not
314  /// supposed to take place (for example, book update failed
315  /// due to corrupted data). Handler will handle an issue by
316  /// itself, thus no special handling is required for the case.
317  virtual
318  void
320  Handler&,
321  const ErrorArgs&)
322  {
323  }
324 };
325 
Indicates data processing failure.
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:110
Indicates data receive timeout.
void status(RecoveryCompletionStatus::Enum status)
Assigns completion status of the recovery.
RecoveryCompletionStatus::Enum status() const
Indicates completion status of the recovery.
RecoveryCompletionArgs()
Initializes as blank instance.
Recovery accomplished successfully.
void details(const std::string &message)
Issue::Enum id() const
Issue identifier.
virtual void onEndOfMarketRecovery(Handler &, const RecoveryCompletionArgs &)
virtual void onInstrumentRecovery(Handler &)
Download or replay of Security Definition(d) messages is started.
IssueArgs(Issue::Enum id, const std::string &source, const std::string &description)
Initializes issue with provided attributes.
Identifies network connection failure.
Indicates data reception failure.
virtual void onWarning(Handler &, const WarningArgs &)
virtual void onRealtimeProcessing(Handler &)
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:54
virtual void onStopped(Handler &)
Invoked when Handler has stopped market data processing.
IssueArgs WarningArgs
Warning arguments.
Indicates internal queue overflow.
Indicates error in data sequence.
#define ONIXS_CMEMDH_LTWT_STRUCT
Definition: Bootstrap.h:114
Collection of statuses of recovery completion.
virtual void onMarketRecovery(Handler &)
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168
Gathers information about the recovery completion.
virtual void onEndOfRealtimeProcessing(Handler &)
virtual void onError(Handler &, const ErrorArgs &)
RecoveryCompletionArgs(RecoveryCompletionStatus::Enum status, const std::string &message=std::string())
Initializes with given details.
Operation performed by the Handler failed.
virtual void onTcpRecovery(Handler &)
Handler spawned recovery of lost packets over TCP feed.
virtual void onEndOfInstrumentRecovery(Handler &, const RecoveryCompletionArgs &)
Download or replay of Security Definition(d) messages is finished.
const std::string & details() const
virtual void onEndOfTcpRecovery(Handler &, const RecoveryCompletionArgs &)
Handler accomplished recovery of lost packets over TCP feed.
Events raised by Handler while processing market data.
virtual void onStarted(Handler &)
Handler is has started to process market data.
const std::string & source() const
Source of the issue.
#define ONIXS_CMEMDH_EXPORTED_STRUCT
Definition: Bootstrap.h:66
const std::string & description() const
Human readable description of the issue.
IssueArgs ErrorArgs
Error arguments.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:172