Example #1
0
        private void RegisterRabbit(ContainerBuilder builder)
        {
            builder.RegisterType <InternalQuotePublisher>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Rabbit.Publishers
                                               .InternalQuotes))
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Name))
            .AsSelf()
            .As <IInternalQuotePublisher>()
            .SingleInstance();

            builder.RegisterType <InternalOrderBookPublisher>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Rabbit.Publishers
                                               .InternalOrderBooks))
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Name))
            .AsSelf()
            .As <IInternalOrderBookPublisher>()
            .SingleInstance();

            builder.RegisterType <LykkeTradeSubscriberMonitor>()
            .AsSelf()
            .SingleInstance();

            builder.RegisterType <LykkeTradeSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Rabbit.Subscribers
                                               .LykkeTrades))
            .AsSelf()
            .SingleInstance();

            builder.RegisterType <B2C2QuoteSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Rabbit.Subscribers
                                               .B2C2Quotes))
            .AsSelf()
            .SingleInstance();

            builder.RegisterType <B2C2OrderBooksSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.LiquidityEngineService.Rabbit.Subscribers
                                               .B2C2OrderBooks))
            .AsSelf()
            .SingleInstance();

            QuotesSettings quotesSettings = _settings.CurrentValue.LiquidityEngineService.Rabbit.Subscribers.Quotes;

            foreach (Exchange exchange in quotesSettings.Exchanges)
            {
                builder.RegisterType <QuoteSubscriber>()
                .AsSelf()
                .WithParameter(TypedParameter.From(new SubscriberSettings
                {
                    Exchange         = exchange.Endpoint,
                    Queue            = quotesSettings.Queue,
                    ConnectionString = quotesSettings.ConnectionString
                }))
                .SingleInstance();
            }
        }
Example #2
0
        private void RegisterRabbit(ContainerBuilder builder, IReadOnlyDictionary <string, string> assetPairMapping)
        {
            builder.RegisterType <LykkeTradeSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.IndexHedgingEngineService.Rabbit.Subscribers
                                               .LykkeTrades))
            .AsSelf()
            .SingleInstance();

            builder.RegisterType <LykkeOrderBookSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.IndexHedgingEngineService.Rabbit.Subscribers
                                               .LykkeOrderBooks))
            .AsSelf()
            .SingleInstance();

            builder.RegisterType <IndexTickPriceSubscriber>()
            .WithParameter(TypedParameter.From(_settings.CurrentValue.IndexHedgingEngineService.Rabbit.Subscribers
                                               .IndexTickPrices))
            .AsSelf()
            .SingleInstance();

            QuotesSettings quotesSettings = _settings.CurrentValue.IndexHedgingEngineService.Rabbit.Subscribers.Quotes;

            foreach (Exchange exchange in quotesSettings.Exchanges)
            {
                builder.RegisterType <QuoteSubscriber>()
                .AsSelf()
                .WithParameter(TypedParameter.From(new SubscriberSettings
                {
                    Exchange         = exchange.Endpoint,
                    Queue            = quotesSettings.Queue,
                    ConnectionString = quotesSettings.ConnectionString
                }))
                .WithParameter(TypedParameter.From(assetPairMapping))
                .SingleInstance();
            }
        }