almost got the replay going
This commit is contained in:
1 parent
050ea18a02
commit
f575b82ce0
6 files changed
+319
-9
No files matched your search
@@ -0,0 +1,59 @@
|
||||
#include "MarketDataReceiverServiceServer.h"
|
||||
#include "lib/config/config.h"
|
||||
#include "lib/utils/TimeStamp.h"
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include "lib/utils/AuthToken.h"
|
||||
#include "lib/domain_model/Security.h"
|
||||
#include "lib/logging/logging.h"
|
||||
|
||||
#include "lib/config/protos/system.pb.h"
|
||||
#include "lib/md/protos/co2.pb.h"
|
||||
#include "lib/md/relay/RelayClient.h"
|
||||
#include "lib/md/MDClient.h"
|
||||
#include "lib/md/MDProducer.h"
|
||||
#include "lib/api/apicore.pb.h"
|
||||
#include "lib/api/services/MarketDataRelay.server.pb.h"
|
||||
#include "lib/api/services/MarketDataRelay.client.pb.h"
|
||||
#include "lib/api/public/ServiceContext.h"
|
||||
|
||||
using namespace bts::co2;
|
||||
using std::unique_ptr;
|
||||
using std::shared_ptr;
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
shared_ptr<IRelayWriter> mkrelayproducer(bool shared);
|
||||
|
||||
struct MarketDataReceiverServiceServer::PImpl
|
||||
{
|
||||
shared_ptr<IRelayWriter> producer;
|
||||
PImpl(bts::api::ServiceContext&) : producer(mkrelayproducer(true))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
MarketDataReceiverServiceServer::MarketDataReceiverServiceServer(bts::api::ServiceContext& ctx) :
|
||||
bts::co2::AuthenticatedMarketDataReceiverServiceBase(ctx), me(new PImpl(ctx))
|
||||
{
|
||||
}
|
||||
|
||||
MarketDataReceiverServiceServer::~MarketDataReceiverServiceServer() {}
|
||||
|
||||
void MarketDataReceiverServiceServer::push_md(const api::AuthToken& token, const bts::co2::MDReply& md,
|
||||
const std::function<void(const bts::api::ResultMessage&)>& reply)
|
||||
{
|
||||
bts::api::ResultMessage res;
|
||||
res.set_success(false);
|
||||
|
||||
api::user::TokenPayload payload;
|
||||
if (api::auth::decode_token(token, &payload))
|
||||
{
|
||||
bool has_new_security = false;
|
||||
me->producer->write(md, &has_new_security);
|
||||
res.set_success(true);
|
||||
}
|
||||
reply(res);
|
||||
}
|
||||
|
||||
}}
|
||||
Reference in new issue
Block a user