OnixS C++ CME Market Data Handler  4.8.0.10
API documentation
Pages/ListeningToFeedEvents.md
Go to the documentation of this file.
1 \addtogroup feed-event-listener
2 
3 \brief Explains events fired by Handler to reflect multicast and TCP feed events.
4 
5 \details The Handler listens to market data on different network
6 sources while performing live market data processing transmitted
7 by MDP.
8 
9 To provide users with more flexibility and to implement their
10 trading strategies as well as testing suites, the SDK exposes an additional
11 listening interface, the OnixS::CME::MDH::FeedListener class, to get notified
12 on various aspects related with multicast and TCP feeds.
13 
14 It's necessary to bind an instance of the OnixS::CME::MDH::FeedListener
15 with an instance of the OnixS::CME::MDH::Handler using the
16 OnixS::CME::MDH::Handler::registerFeedListener member to
17 get subscribed to feed events.
18 
19 The following table depicts which of listeners' members are invoked by
20 the bound OnixS::CME::MDH::Handler instance and under which circumstances.
21 
22 <table>
23  <tr>
24  <th>Event</th>
25  <th>Description</th>
26  </tr>
27  <tr>
28  <td>
29  OnixS::CME::MDH::FeedListener::onFeedConnected
30  </td>
31  <td>
32  Invoked when the Handler starts listening to market
33  data on the feed passed to a callback as a parameter
34  and already established connection with a remote source
35  or joined multicast group in case of a multicast source.
36  </td>
37  </tr>
38  <tr>
39  <td>
40  OnixS::CME::MDH::FeedListener::onFeedDisconnected
41  </td>
42  <td>
43  Invoked when the Handler accomplished listening to market
44  data on the feed and already disconnected from a remote
45  source or unjoined a multicast group.
46  </td>
47  </tr>
48  <tr>
49  <td>
50  OnixS::CME::MDH::FeedListener::onFeedPacket
51  </td>
52  <td>
53  Invoked when a packet is received on the given feed.
54  \note An important aspect of the given member is the fact that
55  it's invoked for each packet received by the feed. That means
56  duplicated and out-of-order packets are passed through this
57  callback as well as sequenced packets. Also, the given member
58  is invoked immediately when a packet is received and timestamped
59  using a watch service associated with a Feed Engine instance managing
60  the feed for which the packet was received.
61  Therefore, callback invocation differs from similar members
62  of the OnixS::CME::MDH::MarketDataListener, which are invoked
63  only when data is passed through processing session rules
64  and is scheduled for actual processing.
65  </td>
66  </tr>
67 </table>
68 
69 \section feed-identification Feed Identification
70 
71 Each callback of the OnixS::CME::MDH::FeedListener supplies
72 information about a source of data which is encapsulated into
73 the OnixS::CME::MDH::NetFeed class. The given class allows to
74 identify various attributes of a feed like type (instrument,
75 snapshot, incremental), role (A, B), unique identifier, etc.
76 
77 \subsection feed-tracing Implementing Feed Tracing
78 
79 The OnixS::CME::MDH::FeedListener::onFeedPacket callback is
80 invoked each time data is received on a feed, no matter whether
81 that data is outdated or duplicates the already received one.
82 An instance of the OnixS::CME::MDH::PacketArgs allows to access
83 received data via OnixS::CME::MDH::PacketArgs::packet member and
84 obtain information on a souce of data using the
85 OnixS::CME::MDH::PacketArgs::source member. It's possible to
86 implement various tracing facilities to determine duplicates,
87 gaps in data for a particular feed or all feeds of a particular
88 type having the details on received packet (primarily sequence
89 number) and its origin. The OnixS::CME::MDH::PacketArgs::receiveTime
90 attribute helps to identify delays in receiving data for a
91 particular feed. The whole analysis usually helps in tracing
92 network issues on an application level.