OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.2.2
API documentation
EobiHandlerImpl.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 <boost/unordered_set.hpp>
25 
26 #include "../BaseHandlerImp.h"
27 #include "../HandlerLogger.h"
28 #include "../Version.h"
29 
30 #include "EobiListenerHolder.h"
31 #include "EobiDataRepository.h"
32 #include "EobiPacketProcessor.h"
33 #include "EobiBookImpl.h"
34 
35 namespace OnixS {
36 namespace Eurex {
37 namespace MarketData {
38 namespace EOBI {
39 namespace Implementation {
40 
42 
44 {
45  typedef BaseHandlerImp base;
46 
47 public:
48  /// Initialize new instance.
49  explicit
50  EobiHandlerImpl(const EobiHandlerSettings & settings);
51 
52  /// Finalize instance.
53  ~EobiHandlerImpl() override;
54 
55  void bindFeedEngine(FeedEngine& feedEngine);
56 
57  /// Start handler.
58  void start ();
59 
60  /// Starts replaying previously logged data.
61  void start(const ReplayOptions& options);
62 
63  /// Stop handler.
64  void stop ();
65 
66  /// Returns commons services as shared object.
67  EobiListenerHolder& listenerHolder() { return *listenerHolder_; }
68 
69  /// Invoke helpers
70  void invokeError (ErrorCode::Enum code, const std::string& description) override { listenerHolder_->invokeError (code, description); }
71  void invokeWarning (const std::string& description) override { listenerHolder_->invokeWarning (description); }
72 
73  void setPartitionIdFilters(const PartitionIdFilters& filters);
74  void removeAllPartitionIdFilters();
75  void setMarketSegmentIdFilters(const MarketSegmentIdFilters& filters);
76  void removeAllMarketSegmentIdFilters();
77  void setSecurityIdFilters(const SecurityIdFilters& filters);
78  void removeAllSecurityIdFilters();
79 
80 protected:
81  void onStarted() override;
82  void onStopped() override;
83 
84  void onPrepareFeeds();
85 
86  void onStateChanged(State::Enum newState) override;
87 
88 protected:
89  void onIncrementalPacketData(DataSource& dataSource, const char* data, size_t length);
90  void onIncrementalPacketGap();
91  void onApplSeqReset();
92  void onIncrementalInactivity();
93  void onIncrementalFeedInactivity(HandlerCore::MarketData::FE::NetFeedRole::Enum id);
94 
95  void onSnapshotPacketData(DataSource& dataSource, const char* data, size_t length);
96  void onSnapshotPacketGap();
97  void onSnapshotInactivity();
98  void onSnapshotFeedInactivity(HandlerCore::MarketData::FE::NetFeedRole::Enum id);
99 
100  void onSnapshotStartRequest();
101  void onSnapshotStopRequest();
102 
103 private:
104  EobiDataRepository* createAndInitDataRepository(const EobiHandlerSettings &settings);
105  HandlerCore::Common::HandlerLogger* createAndInitLogger(const EobiHandlerSettings &settings);
106  bool shouldLogPackets() const;
107 
108 private:
109  EobiHandlerSettings settings_;
110  boost::scoped_ptr<OrderBookAllocator> bookAllocator_;
111 
112  LoggerPtr logger_;
113  Logging::LogFacility logFacilityForSnapshots_;
114  Logging::LogFacility logFacilityForIncrementals_;
115 
116  boost::scoped_ptr<EobiPacketProcessor> snapshotPacketProcessor_;
117  boost::scoped_ptr<EobiPacketProcessor> incrementalPacketProcessor_;
118  boost::scoped_ptr<EobiListenerHolder> listenerHolder_;
119  boost::scoped_ptr<EobiDataRepository> dataRepository_;
120 
121  MulticastFeedClusterPtr incrementalFeeds_;
122  MulticastFeedClusterPtr snapshotFeeds_;
123 };
124 
125 } // namespace Implementation
126 
128 {
130 
131 public:
132  Impl(const EobiHandlerSettings & settings) : base(settings) {}
133 };
134 
135 }}}}
136 
Manages processing machinery for market data received from feeds.
Definition: FeedEngine.h:287
boost::scoped_ptr< HandlerCore::Common::HandlerLogger > LoggerPtr
void invokeError(ErrorCode::Enum code, const std::string &description) override
Invoke helpers.
Impl(const EobiHandlerSettings &settings)
FilteringTraits::PartitionIdFilters PartitionIdFilters
void invokeWarning(const std::string &description) override
Definition: Defines.h:30
FilteringTraits::MarketSegmentIdFilters MarketSegmentIdFilters
Defines params which affect logs replay.
Definition: Replay.h:74
EOBI handler configuration settings.
FilteringTraits::SecurityIdFilters SecurityIdFilters
Enum
Known (selected) error codes.
Definition: ErrorListener.h:36
EobiListenerHolder & listenerHolder()
Returns commons services as shared object.