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