public void TakeSnapshot()
 {
     lock (_orderBook)
     {
         var snapshotSender = new KafkaSender(_brokerIds, "MarketData.New");
         snapshotSender.Connect();
         _orderBook.Dump().ForEach(o => snapshotSender.Send(new Message(o)));
         snapshotSender.Disconnect();
     }
 }
 public OrderBookServer(string host, int port)
 {
     _brokerIds          = Environment.GetEnvironmentVariable("BrokerIds");
     _orderBook          = new OrderBook();
     _marketDataSender   = new KafkaSender(_brokerIds, "MarketData");
     _marketDataReceiver = new KafkaReceiver(_brokerIds, "MarketData", true);
     _server             = new Grpc.Core.Server
     {
         Services = { Service.BindService(this) },
         Ports    = { { host, port, ServerCredentials.Insecure } }
     };
 }