OnixS C++ CME Streamlined Market Data Handler  1.1.0.5
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  /// Handler spawned recovery of lost packets over TCP feed.
217  virtual
218  void
220  {
221  }
222 
223  /// Handler accomplished recovery of lost packets over TCP feed.
224  virtual
225  void
227  Handler&,
228  const RecoveryCompletionArgs&)
229  {
230  }
231 
232  /// Handler resumed real-time processing of
233  /// market data received over incremental feeds.
234  virtual
235  void
237  {
238  }
239 
240  /// Handler suspended real-time processing of
241  /// market data received over incremental feeds.
242  virtual
243  void
245  {
246  }
247 
248  /// Non-critical issue occurred while Handler is
249  /// processing market data. Handler will handle
250  /// an issue by itself, thus no special handling
251  /// is required for the case. Supplied parameters
252  /// exposes details information on the issue.
253  virtual
254  void
256  Handler&,
257  const WarningArgs&)
258  {
259  }
260 
261  /// Error occurred while Handler is processing market
262  /// data. In contrast to warnings, given issue indicates
263  /// the fact Handler fell into a conditions which are not
264  /// supposed to take place (for example, book update failed
265  /// due to corrupted data). Handler will handle an issue by
266  /// itself, thus no special handling is required for the case.
267  virtual
268  void
270  Handler&,
271  const ErrorArgs&)
272  {
273  }
274 };
275 
RecoveryCompletionArgs()
Initializes as blank instance.
IssueArgs WarningArgs
Warning arguments.
void status(RecoveryCompletionStatus::Enum status)
Assigns completion status of the recovery.
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:54
virtual void onTcpRecovery(Handler &)
Handler spawned recovery of lost packets over TCP feed.
Issue::Enum id() const
Issue identifier.
virtual void onWarning(Handler &, const WarningArgs &)
IssueArgs(Issue::Enum id, const std::string &source, const std::string &description)
Initializes issue with provided attributes.
virtual void onEndOfTcpRecovery(Handler &, const RecoveryCompletionArgs &)
Handler accomplished recovery of lost packets over TCP feed.
const std::string & source() const
Source of the issue.
Events raised by Handler while processing market data.
Collection of statuses of recovery completion.
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition: Bootstrap.h:172
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS
Definition: Bootstrap.h:110
const std::string & description() const
Human readable description of the issue.
virtual void onStopped(Handler &)
Invoked when Handler has stopped market data processing.
Gathers information about the recovery completion.
Identifies network connection failure.
RecoveryCompletionStatus::Enum status() const
Indicates completion status of the recovery.
virtual void onError(Handler &, const ErrorArgs &)
#define ONIXS_CMESTREAMLINEDMDH_EXPORTED_STRUCT
Definition: Bootstrap.h:66
RecoveryCompletionArgs(RecoveryCompletionStatus::Enum status, const std::string &message=std::string())
Initializes with given details.
IssueArgs ErrorArgs
Error arguments.
#define ONIXS_CMESTREAMLINEDMDH_LTWT_STRUCT
Definition: Bootstrap.h:114
virtual void onStarted(Handler &)
Handler is has started to process market data.
Operation performed by the Handler failed.
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168