OnixS C++ CME iLink 3 Binary Order Entry Handler  1.14.0
API Documentation
SessionListener.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #include <OnixS/CME/iLink3/ABI.h>
25 
26 #include <string>
27 
28 namespace OnixS {
29 namespace CME {
30 namespace iLink3 {
31 
33 
34 /**
35  * Session Warning Reason.
36  */
38 {
39  enum Enum
40  {
41  /// General session-related warning.
43 
44  /// Incoming message sequence gap is detected.
46 
47  /// Received the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Sequence">Sequence</a> message with
48  /// the `Lapsed` value of the `KeepAliveIntervalLapsed` field.
50 
51  /// Unexpected SBE Schema version is received from CME.
53 
54  /// The value of the `PreviousUUID` field in the received
55  /// <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Establishment+Acknowledgment">Establishment Acknowledgment</a>
56  /// message does not match to the local value.
58 
59  /// Received an unexpected `NextSeqNo` value.
61 
62  /// Received an unsupported message type.
64 
65  /// The incoming message has a sequence number is out of the expected range and the <i>PossRetransFlag</i> is
66  /// set, it indicates a warning. It is strongly recommended that the session be terminated and manual intervention
67  /// be initiated.
69 
70  /// Received a message with an unexpected uuid
72 
73  /// Raised when the `KeepAliveInterval` has expired and no keep alive message is received.
75 
76  /// Exception was thrown from user's event handler.
78 
79  /// An exception is thrown from the user-provided Session Storage
81 
82  /// Session state cannot be restored.
84 
85  /// Raised when the AsyncFileBasedStorage queue exceeded `SessionSettings::asyncFileBasedStorageQueueMaxSize`
87 
88  /// Raised when the license will expire in less than `SessionSettings::licenseAlertingDaysBeforeExpiration`
90 
91  /// A response message with unexpected `requestTimestamp` field value is received
93 
94  /// The <i>Retransmit Reject</i> message is received in reply to the <i>Retransmit Request</i> message.
96 
97  /// Telecommunication link error is detected.
99 
100  /// After sending the initial Negotiate or Establish message the telecommunication link error is detected.
102 
103  /// Error setting socket option
105 
106  /// Cannot backup the file.
108 
109  /// Session state cannot be restored.
111  };
112 
113  ONIXS_ILINK3_EXPORTED static const char* toString(Enum type) ONIXS_ILINK3_NOTHROW;
114 };
115 
116 /**
117  * Session Error Reason.
118  */
120 {
121  enum Enum
122  {
123  /// Internal error
125 
126  /// A general session-related error.
128 
129  /// First message received is not the <i>NegotiationResponse</i> or <i>EstablishmentAck</i> message.
131 
132  /// The <i>Negotiation Reject</i> message is received in reply to the <i>Negotiation</i> message.
134 
135  /// The <i>Establishment Reject</i> message is received in reply to the <i>Establish</i> message.
137 
138  /// The <i>Terminate</i> message is received in reply to the <i>Establish</i> message.
140 
141  /// The incoming message has a sequence number less than expected and the <i>PossRetransFlag</i> is not
142  /// set, it indicates a serious error.
143  /// The incoming message has a sequence number less than expected and the <i>PossRetransFlag</i> is not set, it
144  /// indicates a serious error. It is strongly recommended that the session be terminated and manual intervention
145  /// be initiated.
147 
148  /// Connection cannot be restored.
150 
151  /// Connection cannot be established.
153 
154  /// Exception during processing of an incoming message.
156 
157  /// Received an invalid incoming message.
159 
160  /// When two times the `KeepAliveInterval` has expired and no keep alive
161  /// message is received then the session is terminated ungracefully and will need to be re-established.
163 
164  /// Telecommunication link error is detected.
166 
167  /// After sending the initial Negotiate or Establish message the telecommunication link error is detected.
169 
170  /// The Exchange sent the initial Terminate message.
172 
173  /// The maximum size of the incoming message gap queue is exceeded.
175 
176  /// An exception is thrown from the user-provided Session Storage
178 
179  /// A message with unexpected UUID is received.
181 
182  /// Session state cannot be restored.
184  };
185 
186  ONIXS_ILINK3_EXPORTED static const char* toString(Enum type) ONIXS_ILINK3_NOTHROW;
187 };
188 
189 /// Action to be taken when the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Not+Applied">NotApplied message</a> is received from the exchange.
191  /// Action to be taken when the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Not+Applied">NotApplied message</a> is received from the exchange.
192  enum Enum {
193  /// No messages are sent in reply.
195 
196  /// Send the <a href="https://www.cmegroup.com/confluence/display/EPICSANDBOX/Sequence">Sequence</a> message.
198 
199  /// The default action.
200  Default = DoNothing
201  };
202 };
203 
204 /// Session's Listener.
206 {
207 public:
208  virtual void onNegotiationResponse(const Messaging::NegotiationResponse501 & /*msg*/, Session * /*sn*/) {}
209  virtual void onNegotiationReject(const Messaging::NegotiationReject502 & /*msg*/, Session * /*sn*/) {}
210  virtual void onEstablishmentAck(const Messaging::EstablishmentAck504 & /*msg*/, Session * /*sn*/) {}
211  virtual void onEstablishmentReject(const Messaging::EstablishmentReject505 & /*msg*/, Session * /*sn*/) {}
212  virtual void onSequence(const Messaging::Sequence506 & /*msg*/, Session * /*sn*/) {}
213  virtual void onTerminate(const Messaging::Terminate507 & /*msg*/, Session * /*sn*/) {}
214  virtual void onRetransmitReject(const Messaging::RetransmitReject510 & /*msg*/, Session * /*sn*/) {}
215  virtual void onRetransmission(const Messaging::Retransmission509 & /*msg*/, Session * /*sn*/) {}
216  virtual void onFailover(Messaging::FTI::Enum /*faultToleranceIndicator*/, Session * /*sn*/) {}
217 
220  }
221 
222  virtual void onBusinessReject(const Messaging::BusinessReject521 & /*msg*/, Session * /*sn*/) {}
223  virtual void onExecutionReportNew(const Messaging::ExecutionReportNew522 & /*msg*/, Session * /*sn*/) {}
224  virtual void onExecutionReportModify(const Messaging::ExecutionReportModify531 & /*msg*/, Session * /*sn*/) {}
225  virtual void onExecutionReportCancel(const Messaging::ExecutionReportCancel534 & /*msg*/, Session * /*sn*/) {}
226  virtual void onExecutionReportStatus(const Messaging::ExecutionReportStatus532 & /*msg*/, Session * /*sn*/) {}
231  virtual void onExecutionReportReject(const Messaging::ExecutionReportReject523 & /*msg*/, Session * /*sn*/) {}
235  virtual void onOrderCancelReject(const Messaging::OrderCancelReject535 & /*msg*/, Session * /*sn*/) {}
238  virtual void onMassQuoteAck(const Messaging::MassQuoteAck545 & /*msg*/, Session * /*sn*/) {}
239  virtual void onRequestForQuoteAck(const Messaging::RequestForQuoteAck546 & /*msg*/, Session * /*sn*/) {}
240  virtual void onQuoteCancelAck(const Messaging::QuoteCancelAck563& /*msg*/, Session* /*sn*/) {}
241  virtual void onOrderMassActionReport(const Messaging::OrderMassActionReport562& /*msg*/, Session* /*sn*/) {}
243  virtual void onPartyDetailsListReport(const Messaging::PartyDetailsListReport538 & /*msg*/, Session * /*sn*/) {}
246 
247  /// Called as soon as bytes are received from the wire.
248  virtual void onReceivedBytes(const char * /*bytes*/, size_t /*size*/, Session * /*sn*/) {}
249 
250  /// Called when the SBE message is about to be sent to the wire.
251  virtual void onMessageSending(char * /*bytes*/, size_t /*size*/, Session * /*sn*/) {}
252 
253  /// Called when the session changes its state.
254  virtual void onStateChange(SessionStateId::Enum /*newState*/, SessionStateId::Enum /*prevState*/, Session * /*sn*/) {}
255 
256  /// Called when an error condition is detected.
257  /// \note the message argument provided is a message which caused the problem, must be checked to be valid before usage
258  virtual void onError(SessionErrorReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/, Messaging::SbeMessage) {}
259 
260  /// Called when a warning condition is detected.
261  /// \note the message argument provided is a message which caused the problem, must be checked to be valid before usage
262  virtual void onWarning(SessionWarningReason::Enum /*reason*/, const std::string & /*description*/, Session * /*sn*/, Messaging::SbeMessage) {}
263 
264 protected:
265  virtual ~SessionListener() = 0;
266 };
267 
268 }
269 }
270 }
static const char * toString(Enum type) noexcept
An iLink 3 Session.
Definition: Session.h:44
Raised when the license will expire in less than SessionSettings::licenseAlertingDaysBeforeExpiration...
virtual void onOrderMassActionReport(const Messaging::OrderMassActionReport562 &, Session *)
virtual void onExecutionReportPendingCancel(const Messaging::ExecutionReportPendingCancel564 &, Session *)
virtual void onNegotiationResponse(const Messaging::NegotiationResponse501 &, Session *)
Action to be taken when the NotApplied message is received from the exchange.
virtual void onEstablishmentAck(const Messaging::EstablishmentAck504 &, Session *)
virtual void onEstablishmentReject(const Messaging::EstablishmentReject505 &, Session *)
virtual void onExecutionReportCancel(const Messaging::ExecutionReportCancel534 &, Session *)
Enum
Action to be taken when the NotApplied message is received from the exchange.
virtual void onBusinessReject(const Messaging::BusinessReject521 &, Session *)
After sending the initial Negotiate or Establish message the telecommunication link error is detected...
After sending the initial Negotiate or Establish message the telecommunication link error is detected...
virtual void onExecutionReportNew(const Messaging::ExecutionReportNew522 &, Session *)
A response message with unexpected requestTimestamp field value is received.
virtual void onExecutionReportTradeAddendumOutright(const Messaging::ExecutionReportTradeAddendumOutright548 &, Session *)
Received the Sequence message with the Lapsed value of the KeepAliveIntervalLapsed field...
virtual void onQuoteCancelAck(const Messaging::QuoteCancelAck563 &, Session *)
virtual void onSequence(const Messaging::Sequence506 &, Session *)
The Establishment Reject message is received in reply to the Establish message.
virtual void onExecutionReportTradeOutright(const Messaging::ExecutionReportTradeOutright525 &, Session *)
virtual void onExecutionReportTradeAddendumSpread(const Messaging::ExecutionReportTradeAddendumSpread549 &, Session *)
When two times the KeepAliveInterval has expired and no keep alive message is received then the sessi...
virtual void onWarning(SessionWarningReason::Enum, const std::string &, Session *, Messaging::SbeMessage)
Called when a warning condition is detected.
virtual void onExecutionReportPendingReplace(const Messaging::ExecutionReportPendingReplace565 &, Session *)
virtual void onRequestForQuoteAck(const Messaging::RequestForQuoteAck546 &, Session *)
virtual void onExecutionReportTradeAddendumSpreadLeg(const Messaging::ExecutionReportTradeAddendumSpreadLeg550 &, Session *)
virtual void onPartyDetailsListReport(const Messaging::PartyDetailsListReport538 &, Session *)
virtual void onFailover(Messaging::FTI::Enum, Session *)
virtual void onRetransmitReject(const Messaging::RetransmitReject510 &, Session *)
The maximum size of the incoming message gap queue is exceeded.
virtual void onExecutionReportTradeSpreadLeg(const Messaging::ExecutionReportTradeSpreadLeg527 &, Session *)
The incoming message has a sequence number is out of the expected range and the PossRetransFlag is se...
Definition: Defines.h:40
virtual void onMassQuoteAck(const Messaging::MassQuoteAck545 &, Session *)
virtual void onRetransmission(const Messaging::Retransmission509 &, Session *)
The Terminate message is received in reply to the Establish message.
virtual void onReceivedBytes(const char *, size_t, Session *)
Called as soon as bytes are received from the wire.
Telecommunication link error is detected.
Received a message with an unexpected uuid.
#define ONIXS_ILINK3_API_DECL(typeKind, typeName)
Definition: ABI.h:29
virtual void onPartyDetailsDefinitionRequestAck(const Messaging::PartyDetailsDefinitionRequestAck519 &, Session *)
virtual void onSecurityDefinitionResponse(const Messaging::SecurityDefinitionResponse561 &, Session *)
The incoming message has a sequence number less than expected and the PossRetransFlag is not set...
Raised when the AsyncFileBasedStorage queue exceeded SessionSettings::asyncFileBasedStorageQueueMaxSi...
virtual void onOrderCancelReplaceReject(const Messaging::OrderCancelReplaceReject536 &, Session *)
First message received is not the NegotiationResponse or EstablishmentAck message.
virtual void onNegotiationReject(const Messaging::NegotiationReject502 &, Session *)
virtual void onMessageSending(char *, size_t, Session *)
Called when the SBE message is about to be sent to the wire.
virtual void onExecutionReportReject(const Messaging::ExecutionReportReject523 &, Session *)
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:181
virtual void onTerminate(const Messaging::Terminate507 &, Session *)
A message with unexpected UUID is received.
The value of the PreviousUUID field in the received Establishment Acknowledgment message does not mat...
virtual void onExecutionReportModify(const Messaging::ExecutionReportModify531 &, Session *)
virtual void onExecutionReportElimination(const Messaging::ExecutionReportElimination524 &, Session *)
virtual void onError(SessionErrorReason::Enum, const std::string &, Session *, Messaging::SbeMessage)
Called when an error condition is detected.
An exception is thrown from the user-provided Session Storage.
virtual void onOrderCancelReject(const Messaging::OrderCancelReject535 &, Session *)
virtual NotAppliedAction::Enum onNotApplied(const Messaging::NotApplied513 &, Session *)
Unexpected SBE Schema version is received from CME.
An exception is thrown from the user-provided Session Storage.
Raised when the KeepAliveInterval has expired and no keep alive message is received.
Exception was thrown from user&#39;s event handler.
Received an invalid incoming message.
virtual void onExecutionReportTradeSpread(const Messaging::ExecutionReportTradeSpread526 &, Session *)
#define ONIXS_ILINK3_NOTHROW
Definition: Compiler.h:183
virtual void onExecutionReportStatus(const Messaging::ExecutionReportStatus532 &, Session *)
Telecommunication link error is detected.
The Negotiation Reject message is received in reply to the Negotiation message.
virtual void onStateChange(SessionStateId::Enum, SessionStateId::Enum, Session *)
Called when the session changes its state.
The Retransmit Reject message is received in reply to the Retransmit Request message.