Ejemplo n.º 1
0
        public void Setup()
        {
            connection = Substitute.For <IReliableConnection>();
            model      = Substitute.For <IModelWithConnection>();
            connection.CreateModel().Returns(model);
            publishModule = Substitute.For <IPublishModule>();

            aggregator = new Aggregator();
            sut        = new QueueingPublishingProcess(Substitute.For <IIdGenerator>(),
                                                       Substitute.For <ISequenceGenerator>(),
                                                       Substitute.For <IExchangeResolver>(),
                                                       Substitute.For <IMessageSerializer>(),
                                                       Substitute.For <IMessageTypeResolver>(),
                                                       publishModule, aggregator);
            sut.Start();
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            connection = Substitute.For<IReliableConnection>();
            model = Substitute.For<IModelWithConnection>();
            connection.CreateModel().Returns(model);
            publishModule = Substitute.For<IPublishModule>();

            aggregator = new Aggregator();
            sut = new QueueingPublishingProcess(Substitute.For<IIdGenerator>(),
                                                Substitute.For<ISequenceGenerator>(),
                                                Substitute.For<IExchangeResolver>(),
                                                Substitute.For<IMessageSerializer>(),
                                                Substitute.For<IMessageTypeResolver>(),
                                                publishModule, aggregator);
            sut.Start();
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            connection = Substitute.For<IReliableConnection>();
            model = Substitute.For<IModelWithConnection>();
            connection.CreateModel().Returns(model);

            queueFactory = Substitute.For<IQueueFactory>();
            aggregator = new Aggregator();

            sut = new DefaultConsumingProcess(Substitute.For<IIdGenerator>(),
                                              Substitute.For<IExchangeResolver>(),
                                              Substitute.For<IMessageSerializer>(),
                                              Substitute.For<IMessageTypeResolver>(),
                                              Substitute.For<IConsumerContainer>(),
                                              Substitute.For<IMessageFilter>(),
                                              queueFactory,
                                              Substitute.For<IConsumerInvoker>(),
                                              new RogerOptions(), aggregator);
        }
Ejemplo n.º 4
0
        public void Setup()
        {
            connection = Substitute.For <IReliableConnection>();
            model      = Substitute.For <IModelWithConnection>();
            connection.CreateModel().Returns(model);

            queueFactory = Substitute.For <IQueueFactory>();
            aggregator   = new Aggregator();

            sut = new DefaultConsumingProcess(Substitute.For <IIdGenerator>(),
                                              Substitute.For <IExchangeResolver>(),
                                              Substitute.For <IMessageSerializer>(),
                                              Substitute.For <IMessageTypeResolver>(),
                                              Substitute.For <IConsumerContainer>(),
                                              Substitute.For <IMessageFilter>(),
                                              queueFactory,
                                              Substitute.For <IConsumerInvoker>(),
                                              new RogerOptions(), aggregator);
        }
Ejemplo n.º 5
0
        private void StartConsuming(IReliableConnection connection)
        {
            Model = connection.CreateModel();
            Model.ModelShutdown += ModelOnModelShutdown;

            if (options.PrefetchCount.HasValue)
            {
                log.InfoFormat("Setting QoS with prefetch count {0} on consuming channel", options.PrefetchCount);
                Model.BasicQos(0, options.PrefetchCount.Value, false);
            }

            Endpoint = new RogerEndpoint(Endpoint.IsEmpty ? queueFactory.Create(Model) : queueFactory.Create(Endpoint.Queue, Model));

            CreateBindings(new HashSet <Type>(consumerContainer.GetAllConsumerTypes().SelectMany(supportedMessageTypesResolver.Resolve)));
            log.DebugFormat("Declared and eventually bound endpoint {0}", Endpoint);

            aggregator.Notify(new ConsumingEnabled(Endpoint, connection));

            CreateConsumer();

            consumingTask = Task.Factory.StartNew(ConsumeSynchronously, TaskCreationOptions.LongRunning);
        }