public void Should_return_PriorityMessageHandler()
        {
            // Arrange
            var factory = new PriorityMessageHandlerFactory(NSubstitute.Substitute.For<IConsumerErrorHandler>(),
                                                            NSubstitute.Substitute.For<IRabbitWatcher>());

            // Action
            var handler = factory.Create(NSubstitute.Substitute.For<Func<BasicDeliverEventArgs, Task>>());

            // Assert
            Assert.IsInstanceOfType(handler, typeof(PriorityMessageHandler));
        }
示例#2
0
        public void Should_return_PriorityMessageHandler()
        {
            // Arrange
            var factory = new PriorityMessageHandlerFactory(NSubstitute.Substitute.For<IConsumerErrorHandler>(),
                                                            NSubstitute.Substitute.For<ISerializer>(),
                                                            NSubstitute.Substitute.For<IRabbitWatcher>());

            // Action
            var handler = factory.Create<Customer>("supscriptionName",  (x, y) => { });

            // Assert
            Assert.IsInstanceOfType(typeof(PriorityMessageHandler<Customer>), handler);
        }
        private ITunnel Create(DurableConnection durableConnection, IRabbitWatcher rabbitWatcher)
        {
            var errorHandler = new ConsumerErrorHandler(() => durableConnection.ConnectionFactory, Global.DefaultSerializer, rabbitWatcher);
            var msgHandlerFactory = new PriorityMessageHandlerFactory(errorHandler, Global.DefaultSerializer, rabbitWatcher);
            var consumerManager = new ConsumerManager(rabbitWatcher, msgHandlerFactory, Global.DefaultSerializer);

            var tunnel = new RabbitTunnelWithPriorityQueuesSupport(consumerManager,
                                                                   rabbitWatcher,
                                                                   new DefaultRouteFinder(),
                                                                   durableConnection,
                                                                   Global.DefaultSerializer,
                                                                   Global.DefaultCorrelationIdGenerator,
                                                                   Global.DefaultPersistentMode);
            tunnel.AddSerializerObserver(errorHandler);
            tunnel.AddSerializerObserver(msgHandlerFactory);
            tunnel.AddSerializerObserver(consumerManager);
            return tunnel;
        }
示例#4
0
        private ITunnel Create(DurableConnection durableConnection, IRabbitWatcher rabbitWatcher)
        {
            var errorHandler      = new ConsumerErrorHandler(() => durableConnection.ConnectionFactory, Global.DefaultSerializer, rabbitWatcher);
            var msgHandlerFactory = new PriorityMessageHandlerFactory(errorHandler, Global.DefaultSerializer, rabbitWatcher);
            var consumerManager   = new ConsumerManager(rabbitWatcher, msgHandlerFactory, Global.DefaultSerializer);

            var tunnel = new RabbitTunnelWithPriorityQueuesSupport(consumerManager,
                                                                   rabbitWatcher,
                                                                   new DefaultRouteFinder(),
                                                                   durableConnection,
                                                                   Global.DefaultSerializer,
                                                                   Global.DefaultCorrelationIdGenerator,
                                                                   Global.DefaultPersistentMode);

            tunnel.AddSerializerObserver(errorHandler);
            tunnel.AddSerializerObserver(msgHandlerFactory);
            tunnel.AddSerializerObserver(consumerManager);
            return(tunnel);
        }