private static void RegisterCandlePublisher(ContainerBuilder builder)
        {
            ServiceBusLogger = Program.LogFactory.CreateLogger(nameof(MyServiceBusTcpClient));

            var serviceBusClient = new MyServiceBusTcpClient(Program.ReloadedSettings(e => e.CandleServiceBusHostPort), ApplicationEnvironment.HostName);

            serviceBusClient.Log.AddLogException(ex => ServiceBusLogger.LogError(ex as Exception, "[CANDLE] Exception in MyServiceBusTcpClient"));
            serviceBusClient.Log.AddLogInfo(info => ServiceBusLogger.LogInformation($"[CANDLE] {info}"));
            serviceBusClient.SocketLogs.AddLogException((context, ex) => ServiceBusLogger.LogError(ex as Exception, $"[CANDLE] [Socket {context?.Id}|{context?.Inited}]Exception in MyServiceBusTcpClient on Socket level"));
            serviceBusClient.SocketLogs.AddLogInfo((context, info) => ServiceBusLogger.LogInformation($"[CANDLE] MyServiceBusTcpClient[Socket {context?.Id}|{context?.Inited}] {info}"));

            var candlePublisher = new BidAskMyServiceBusPublisher(serviceBusClient, "spot-bidask");

            builder
            .RegisterInstance(candlePublisher)
            .As <IPublisher <IBidAsk> >()
            .SingleInstance();

            serviceBusClient.Start();
        }
 protected override void OnStarted()
 {
     _logger.LogInformation("OnStarted has been called.");
     _bookAggregator.Start();
     _serviceBusTcpClient.Start();
 }
Esempio n. 3
0
 protected override void OnStarted()
 {
     _busTcpClient.Start();
     _logger.LogInformation("OnStarted has been called.");
 }