Пример #1
0
        public Broker(
            RabbitMqSubscriber <Quote> subscriber,
            ILog logger,
            CandleGenerationController controller,
            string componentName)
            : base(componentName, (int)TimeSpan.FromMinutes(1).TotalMilliseconds, logger)
        {
            this.componentName = componentName;
            this.logger        = logger;
            this.controller    = controller;
            this.subscriber    = subscriber;

            // Using default message reader strategy
            subscriber
            .SetMessageDeserializer(new MessageDeserializer())
            .Subscribe(HandleMessage)
            .SetLogger(logger);
        }
Пример #2
0
        public Broker(
            RabbitMqSubscriber <OrderBook> subscriber,
            RabbitMqPublisher <Quote> publisher,
            ILog logger)
        {
            this.logger     = logger;
            this.subscriber = subscriber;
            this.publisher  = publisher;

            // Using default message reader strategy
            subscriber
            .SetMessageDeserializer(new MessageDeserializer())
            .Subscribe(HandleMessage)
            .SetLogger(logger);

            publisher
            .SetPublishStrategy(new DefaultFnoutPublishStrategy("", durable: true))
            .SetSerializer(new MessageSerializer())
            .SetLogger(logger);

            this.controller = new QuoteFeedController(this, logger, COMPONENT_NAME);
        }