Esempio n. 1
0
        public void Start(QueueConfig queueConfig)
        {
            _queueConsumer         = new QueueConsumer(queueConfig.ExchangeName, queueConfig.ExchangeType, queueConfig.QueueName, queueConfig.RoutingKey, queueConfig.HostName, queueConfig.Vhost, queueConfig.User, queueConfig.Password);
            _inboundQueueProcessor = Task.Factory.StartNew(QueueConsumer);

            _inboundChannel = Channel.CreateBounded <Message>(new BoundedChannelOptions(100000)
            {
                FullMode = BoundedChannelFullMode.Wait, SingleReader = true, SingleWriter = true, AllowSynchronousContinuations = false
            });
            _inboundChannelReader  = _inboundChannel.Reader;
            _inboundChannelWritter = _inboundChannel.Writer;

            _inboundChannelProcessor = Task.Factory.StartNew(async() => await InboundMessageProcessor());
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var tradeFinalizer = new TradeFinalizer();
            var consumerConfig = new QueueConfig
            {
                ExchangeName = "engine-out",
                ExchangeType = "fanout",
                QueueName    = "settlement",
                RoutingKey   = "#",
                HostName     = "localhost",
                Vhost        = "/",
                User         = "******",
                Password     = "******"
            };

            tradeFinalizer.Start(consumerConfig);

            Console.ReadLine();
            tradeFinalizer.Stop();
        }