OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  8.1.0
API documentation
RdiHandlerImpl.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
5 *
6 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
7 * and international copyright treaties.
8 *
9 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
10 * Services Agreement (the Agreement) and Customer end user license agreements granting
11 * a non-assignable, non-transferable and non-exclusive license to use the software
12 * for it's own data processing purposes under the terms defined in the Agreement.
13 *
14 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
15 * of this source code or associated reference material to any other location for further reproduction
16 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
19 * the terms of the Agreement is a violation of copyright law.
20 */
21 
23 
24 #include "Formatting.h"
25 #include "PacketProcessor.h"
26 #include "RdiDataRepository.h"
27 #include "RdiDataRepositoryEx.h"
28 #include "BaseHandlerImp.h"
29 #include "MessagePool.h"
30 
31 
32 namespace OnixS {
33 namespace Eurex {
34 namespace MarketData {
35 namespace Implementation {
36 
38 {
39  typedef BaseHandlerImp base;
40 
41 public:
42  /// Initialize new instance.
43  explicit
44  RdiHandlerImpl(const RdiHandlerSettings & settings);
45 
46  /// Finalize instance.
47  ~RdiHandlerImpl() override;
48 
49  void bindFeedEngine(FeedEngine& feedEngine);
50 
51  /// Start handler.
52  void start ();
53 
54  /// Starts replaying previously logged data.
55  void start(const ReplayOptions& options);
56 
57  /// Stop handler.
58  void stop() override;
59 
60  /// Returns commons services as shared object.
61  ListenerHolder& listenerHolder() { return *listenerHolder_; }
62 
63  /// Invoke helpers
64  void invokeError (const std::string& description) override;
65  void invokeWarning (const std::string& description) override;
66 
67  /// Returns list of descriptors of EMDI interfaces for given product name list
68  EmdiDescriptors findEmdiDescriptors(const MarketSegments& productNames) const;
69 
70  /// Returns list of descriptors of EMDI interfaces for all products
72 
73  /// Returns list of descriptors of MDI interfaces for given product name list
74  MdiDescriptors findMdiDescriptors(const MarketSegments& productNames) const;
75 
76  /// Returns list of descriptors of MDI interfaces for all products
78 
79  /// Returns list of descriptors of EOB interfaces for given product name list
80  EobiDescriptors findEobiDescriptors(const MarketSegments& productNames) const;
81 
82  /// Returns list of descriptors of EOB interfaces for all products
84 
85 private:
86  void initLogger(const HandlerSettings &settings);
87  void initListenerHolder();
88 
89 private:
90  void onStarting() override;
91  void onStopping() override;
92 
93  void onSnapshotStartRequest();
94  void onSnapshotStopRequest();
95 
96  void onIncrementalPacketData(DataSource& dataSource, const char* data, size_t length, size_t headerSize);
97  void onIncrementalPacketGap();
98  void onIncrementalSenderCompIdChange(unsigned int lastSenderCompId, unsigned int newSenderCompId, SequenceNumber lastSeqNum, SequenceNumber newSeqNum);
99  void onIncrementalInactivity();
100  void onIncrementalFeedInactivity(HandlerCore::MarketData::FE::NetFeedRole::Enum id);
101 
102  void onSnapshotPacketData(DataSource& dataSource, const char* data, size_t length, size_t headerSize);
103  void onSnapshotPacketGap();
104  void onSnapshotSenderCompIdChange(unsigned int lastSenderCompId, unsigned int newSenderCompId, SequenceNumber lastSeqNum, SequenceNumber newSeqNum);
105  void onSnapshotInactivity();
106  void onSnapshotFeedInactivity(HandlerCore::MarketData::FE::NetFeedRole::Enum id);
107 
108  void onStateChanged(State::Enum newState) override;
109 
110  void checkXmlFile();
111 
112 private:
113  LoggerPtr logger_;
114  boost::scoped_ptr<ListenerHolder> listenerHolder_;
115 
116  RdiHandlerSettings settings_;
117 
119  boost::scoped_ptr<RdiPacketProcessor> incrementalPacketProcessor_;
120  boost::scoped_ptr<RdiPacketProcessor> snapshotPacketProcessor_;
121 
122  MulticastFeedClusterPtr incrementalFeeds_;
123  MulticastFeedClusterPtr snapshotFeeds_;
124 
125  Logging::LogFacility logFacilityForSnapshots_;
126  Logging::LogFacility logFacilityForIncrementals_;
127 
128  boost::scoped_ptr<FixDecoder> incrementalFixDecoder_;
129  boost::scoped_ptr<FixDecoder> snapshotFixDecoder_;
130 
131  boost::scoped_ptr<RdiDataRepositoryGeneric> dataRepository_;
132  MessagesPool incrementalMessagesPool_;
133 
134  AccumulatingAllocator snapShotContentAllocator_;
135 };
136 
137 } // namespace Implementation
138 
140 {
142 
143 public:
144 Impl(const RdiHandlerSettings & settings)
145  : base(settings)
146 {}
147 };
148 
149 }}}
150 
unsigned int SequenceNumber
Alias for sequence numbers.
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:287
EobiDescriptors findEobiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of EOB interfaces for given product name list.
ListenerHolder & listenerHolder()
Returns commons services as shared object.
void invokeWarning(const std::string &description) override
boost::scoped_ptr< HandlerCore::Common::HandlerLogger > LoggerPtr
EobiDescriptor::Collection EobiDescriptors
EmdiDescriptors findAllEmdiDescriptors() const
Returns list of descriptors of EMDI interfaces for all products.
Impl(const RdiHandlerSettings &settings)
Handler base configuration settings.
EobiDescriptors findAllEobiDescriptors() const
Returns list of descriptors of EOB interfaces for all products.
void invokeError(const std::string &description) override
Invoke helpers.
Definition: Defines.h:30
Defines params which affect logs replay.
Definition: Replay.h:77
MdiDescriptors findAllMdiDescriptors() const
Returns list of descriptors of MDI interfaces for all products.
Implementation::RdiHandlerImpl base
RDI handler configuration settings.
EmdiDescriptor::Collection EmdiDescriptors
MdiDescriptor::Collection MdiDescriptors
EmdiDescriptors findEmdiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of EMDI interfaces for given product name list.
MdiDescriptors findMdiDescriptors(const MarketSegments &productNames) const
Returns list of descriptors of MDI interfaces for given product name list.
RdiHandlerImpl(const RdiHandlerSettings &settings)
Initialize new instance.
IInterfaceDescriptorProvider::MarketSegments MarketSegments