This commit is contained in:
Pedro Pinto committed 2018-12-05 21:52:49 +00:00
1 parent 096787d710
commit e6a9c7e433
150 files changed
+2757 -2765

No files matched your search

+13 -25
View File
@@ -9,7 +9,6 @@
#include "lib/mercury/executor/Executor.h"
#include "lib/metrics/metrics.h"
#include "lib/orderman/actors/AsyncFactory.h"
#include "lib/orderman/actors/ExecutionGateway.h"
#include "lib/orderman/actors/FillStore.h"
#include "lib/orderman/actors/MDSource.h"
#include "lib/orderman/actors/MDSupplementarySource.h"
@@ -18,12 +17,12 @@
#include "lib/orderman/actors/ServiceBridge.h"
#include "lib/orderman/actors/order_manager/OrderManager.h"
#include "lib/orderman/order_factory/DynamicOrderRegistry.h"
#include "lib/utils/bts_chrono.h"
#include "lib/plugin/plugin.h"
#include "lib/plugin/SparkServices.h"
#include "lib/plugin/plugin.h"
#include "lib/utils/bts_chrono.h"
#include "lib/utils/thread_manager.h"
#include "lib/utils/type_name.h"
#include <boost/algorithm/string/predicate.hpp>
namespace bts {
@@ -90,12 +89,11 @@ ActorThread *find_thread_for_actor(
struct OrderServiceServer::PImpl {
PImpl(bts::api::ServiceContext &ctx,
std::shared_ptr<api::ISyntheticSecurityService> &ss,
DynamicOrderRegistry const &d,
metrics::MetricsContainer &stats)
DynamicOrderRegistry const &d, metrics::MetricsContainer &stats, trace::PerfLog &log)
: service_bridge(), service_ready(false), known_orders(), known_fills(),
publish_orders(), publish_fills(),
admin_service(ctx.locate<api::admin::AdminService>()), md_consumer(ss),
stats(stats), dyn_order_registry(d) {}
stats(stats), dyn_order_registry(d),log(log) {}
ServiceBridge *service_bridge;
@@ -111,15 +109,16 @@ struct OrderServiceServer::PImpl {
bts::md::MDConsumer md_consumer;
metrics::MetricsContainer &stats;
DynamicOrderRegistry const &dyn_order_registry;
trace::PerfLog &log;
};
OrderServiceServer::OrderServiceServer(
bts::api::ServiceContext &ctx,
std::shared_ptr<api::ISyntheticSecurityService> &ss,
DynamicOrderRegistry const&d,
metrics::MetricsContainer &stats, PerfTraceLog &log)
: api::orderman::OrderServiceBase(ctx), me(new PImpl(ctx, ss, d,stats)) {
DynamicOrderRegistry const &d, metrics::MetricsContainer &stats,
trace::PerfLog &log)
: api::orderman::OrderServiceBase(ctx), me(new PImpl(ctx, ss, d, stats,log)) {
me->publish_orders = make_orders_publisher();
me->publish_fills = make_fills_publisher();
@@ -138,23 +137,14 @@ OrderServiceServer::OrderServiceServer(
bts_assert_msg(thread,
"Could not find a configured thread for MDSource. See the "
"OrdermanCfg key");
thread->executor.spawn<MDSource>(me->md_consumer, me->stats);
thread->executor.spawn<MDSource>(me->md_consumer, me->stats,log);
// OrderManager
thread = find_thread_for_actor("OrderManager", me->actor_threads);
bts_assert_msg(thread,
"Could not find a configured thread for OrderManager. See "
"the OrdermanCfg key");
thread->executor.spawn<OrderManager>(d);
// ExecutionGateway's
thread = find_thread_for_actor("ExecutionGateway", me->actor_threads);
bts_assert_msg(thread,
"Could not find a configured thread for ExecutionGateway "
"instances. See the OrdermanCfg key");
auto &all_connections = config::get<config::JetFIX>().connection();
for (auto const &c : all_connections)
thread->executor.spawn<ExecutionGateway>(c, log);
thread->executor.spawn<OrderManager>(d,me->log);
// Timer
thread = find_thread_for_actor("Timer", me->actor_threads);
@@ -214,9 +204,7 @@ OrderServiceServer::OrderServiceServer(
[this, &ctx](auto const &fill) {
ctx.post([this, fill] { this->on_fills(fill); });
},
me->dyn_order_registry,
thread->executor.make_proxy());
me->dyn_order_registry, thread->executor.make_proxy());
thread->executor.activate(me->service_bridge);