fix: Run heartbeat timer in MarketDataGateway

This is why we were getting those heartbeat asserts. Previously,
only ExchangeSimApplication would start this timer. Since
MarketDataGateway doesn't share its MDProducer with
ExchangeSimApplication, it must start one itself.
This commit is contained in:
John Colvin committed 2024-11-29 15:05:12 +00:00
1 parent 8886054416
commit 1ecaaf4cbe
1 file changed
+7 -1
@@ -21,6 +21,7 @@
#include "system/FMT.h"
#include "system/logging/logging.h"
#include "system/os.h"
#include "system/threading/dispatcher.h"
#include <bits/stdint-uintn.h>
#include <memory>
@@ -50,12 +51,17 @@ struct MarketDataGateway::PImpl {
shared_ptr<GeneralSecurityIndex> sec_index;
shared_ptr<MDProducer> md_producer;
shared_ptr<IMarketDataListener> listener;
utils::DispatcherTimer timer;
MdSink(api::Venue venue, shared_ptr<IDGenerator> sec_id_store)
: sec_index(std::make_shared<GeneralSecurityIndex>()),
md_producer(std::make_shared<MDProducer>()),
listener(std::make_shared<GeneralMarketDataListener>(
sec_index, md_producer, venue, sec_id_store)) {}
sec_index, md_producer, venue, sec_id_store)),
timer(
utils::Dispatcher::background(),
200,
[producer = this->md_producer]() { producer->heartbeat(); }) {}
};
MarketDataConfig config;