Ejemplo n.º 1
0
    public void DirectChannel_Send_10_000_000_SingleHandler()
    {
        var services = new ServiceCollection();
        var config   = new ConfigurationBuilder().Build();

        services.AddSingleton <IConfiguration>(config);
        services.AddSingleton <IApplicationContext, GenericApplicationContext>();
        services.AddSingleton <IIntegrationServices, IntegrationServices>();
        var provider      = services.BuildServiceProvider();
        var directChannel = new DirectChannel(provider.GetService <IApplicationContext>());
        var handler       = new CounterHandler();

        directChannel.Subscribe(handler);
        var message = Message.Create("test");

        directChannel.Send(message);
        for (var i = 0; i < 10_000_000; i++)
        {
            directChannel.Send(message);
        }

        if (handler.Count != 10_000_000 + 1)
        {
            throw new InvalidOperationException("Handler count invalid");
        }
    }
Ejemplo n.º 2
0
        public void FailoverNoLoadBalancing()
        {
            var channel = new DirectChannel(provider, null, "loadBalancerNoFailover", null);

            channel.Failover = true;
            handlerA.Setup((h) => h.HandleMessage(message)).Throws(new MessageRejectedException(message, null));
            var dispatcher = channel.Dispatcher;

            dispatcher.AddHandler(handlerA.Object);
            dispatcher.AddHandler(handlerB.Object);

            try
            {
                channel.Send(message);
            }
            catch (Exception)
            { /* ignore */
            }

            handlerA.Verify((h) => h.HandleMessage(message), Times.Exactly(1));
            handlerB.Verify((h) => h.HandleMessage(message), Times.Exactly(1));

            try
            {
                channel.Send(message);
            }
            catch (Exception)
            { /* ignore */
            }

            handlerA.Verify((h) => h.HandleMessage(message), Times.Exactly(2));
            handlerB.Verify((h) => h.HandleMessage(message), Times.Exactly(2));
        }
Ejemplo n.º 3
0
        public void TestSendOneHandler_10_000_000()
        {
            /*
             *  INT-3308 - used to run 12 million/sec
             *  1. optimize for single handler 20 million/sec
             *  2. Don't iterate over empty datatypes 23 million/sec
             *  3. Don't iterate over empty interceptors 31 million/sec
             *  4. Move single handler optimization to dispatcher 34 million/sec
             *
             *  29 million per second with increment counter in the handler
             */
            var channel = new DirectChannel(provider.GetService <IApplicationContext>());

            var handler = new CounterHandler();

            channel.Subscribe(handler);
            var message = Message.Create("test");

            Assert.True(channel.Send(message));
            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(10000001, handler.Count);
        }
Ejemplo n.º 4
0
        public void TestSendOneHandler_10_000_000()
        {
            /*
             *  INT-3308 - used to run 12 million/sec
             *  1. optimize for single handler 20 million/sec
             *  2. Don't iterate over empty datatypes 23 million/sec
             *  3. Don't iterate over empty interceptors 31 million/sec
             *  4. Move single handler optimization to dispatcher 34 million/sec
             *
             *  29 million per second with increment counter in the handler
             */
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var channel  = new DirectChannel(provider);

            var handler = new CounterHandler();

            channel.Subscribe(handler);
            var message = new GenericMessage("test");

            Assert.True(channel.Send(message));
            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(10000001, handler.Count);
        }
        public void NoFailoverNoLoadBalancing()
        {
            var channel = new DirectChannel(provider.GetService <IApplicationContext>(), null, "noLoadBalancerNoFailover", null);

            channel.Failover = false;
            handlerA.Setup((h) => h.HandleMessage(message)).Throws(new MessageRejectedException(message, null));
            var dispatcher = channel.Dispatcher;

            dispatcher.AddHandler(handlerA.Object);
            dispatcher.AddHandler(handlerB.Object);
            try
            {
                channel.Send(message);
            }
            catch (Exception)
            {
            }

            try
            {
                channel.Send(message);
            }
            catch (Exception)
            {
            }

            handlerA.Verify((h) => h.HandleMessage(message), Times.Exactly(2));
            handlerB.Verify((h) => h.HandleMessage(message), Times.Exactly(0));
        }
Ejemplo n.º 6
0
    public void DirectChannel_Send_10_000_000_TwoHandlers()
    {
        var services = new ServiceCollection();

        services.AddSingleton <IIntegrationServices, IntegrationServices>();
        var provider = services.BuildServiceProvider();
        var channel  = new DirectChannel(provider);
        var count1   = new CounterHandler();
        var count2   = new CounterHandler();

        channel.Subscribe(count1);
        channel.Subscribe(count2);
        var message = new GenericMessage("test");

        for (var i = 0; i < 10_000_000; i++)
        {
            channel.Send(message);
        }

        if (count1.Count != 5000000)
        {
            throw new InvalidOperationException("Handler count1 invalid");
        }

        if (count2.Count != 5000000)
        {
            throw new InvalidOperationException("Handler count2 invalid");
        }
    }
Ejemplo n.º 7
0
        public void TestSendTwoHandlers_10_000_000()
        {
            /*
             *  INT-3308 - used to run 6.4 million/sec
             *  1. Skip empty iterators as above 7.2 million/sec
             *  2. optimize for single handler 6.7 million/sec (small overhead added)
             *  3. remove LB rwlock from UnicastingDispatcher 7.2 million/sec
             *  4. Move single handler optimization to dispatcher 7.3 million/sec
             */
            var channel = new DirectChannel(provider.GetService <IApplicationContext>());
            var count1  = new CounterHandler();
            var count2  = new CounterHandler();

            channel.Subscribe(count1);
            channel.Subscribe(count2);
            var message = Message.Create("test");

            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(5000000, count1.Count);
            Assert.Equal(5000000, count2.Count);
        }
Ejemplo n.º 8
0
        public void TestSendFourHandlers_10_000_000()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var channel  = new DirectChannel(provider);
            var count1   = new CounterHandler();
            var count2   = new CounterHandler();
            var count3   = new CounterHandler();
            var count4   = new CounterHandler();

            channel.Subscribe(count1);
            channel.Subscribe(count2);
            channel.Subscribe(count3);
            channel.Subscribe(count4);
            var message = new GenericMessage("test");

            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(10000000 / 4, count1.Count);
            Assert.Equal(10000000 / 4, count2.Count);
            Assert.Equal(10000000 / 4, count3.Count);
            Assert.Equal(10000000 / 4, count4.Count);
        }
Ejemplo n.º 9
0
        public void TestSendTwoHandlers_10_000_000()
        {
            /*
             *  INT-3308 - used to run 6.4 million/sec
             *  1. Skip empty iterators as above 7.2 million/sec
             *  2. optimize for single handler 6.7 million/sec (small overhead added)
             *  3. remove LB rwlock from UnicastingDispatcher 7.2 million/sec
             *  4. Move single handler optimization to dispatcher 7.3 million/sec
             */
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var channel  = new DirectChannel(provider);
            var count1   = new CounterHandler();
            var count2   = new CounterHandler();

            channel.Subscribe(count1);
            channel.Subscribe(count2);
            var message = new GenericMessage("test");

            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(5000000, count1.Count);
            Assert.Equal(5000000, count2.Count);
        }
        public void FailoverNoLoadBalancingConcurrent()
        {
            var channel = new DirectChannel(provider.GetService <IApplicationContext>(), null, "noLoadBalancerFailover", null);

            channel.Failover = true;
            handlerA.Setup((h) => h.HandleMessage(message)).Throws(new MessageRejectedException(message, null));
            var dispatcher = channel.Dispatcher;

            dispatcher.AddHandler(handlerA.Object);
            dispatcher.AddHandler(handlerB.Object);
            dispatcher.AddHandler(handlerC.Object);

            var start1   = new CountdownEvent(1);
            var allDone1 = new CountdownEvent(TOTAL_EXECUTIONS);
            var message2 = message;
            var failed1  = 0;

            void MessageSenderTask()
            {
                try
                {
                    start1.Wait();
                }
                catch (Exception)
                {
                    throw;
                }

                var sent = false;

                try
                {
                    sent = channel.Send(message2);
                }
                catch (Exception e2)
                {
                    exceptionRegistry.Object.Add(e2);
                }

                if (!sent)
                {
                    failed1 = 1;
                }

                allDone1.Signal();
            }

            for (var i = 0; i < TOTAL_EXECUTIONS; i++)
            {
                Task.Run(MessageSenderTask);
            }

            start1.Signal();
            Assert.True(allDone1.Wait(10000));
            Assert.Equal(0, failed1);
            handlerA.Verify((h) => h.HandleMessage(message2), Times.Exactly(TOTAL_EXECUTIONS));
            handlerB.Verify((h) => h.HandleMessage(message2), Times.Exactly(TOTAL_EXECUTIONS));
            handlerC.Verify((h) => h.HandleMessage(message2), Times.Never());
            exceptionRegistry.Verify((list) => list.Add(It.IsAny <Exception>()), Times.Never());
        }
Ejemplo n.º 11
0
        public void NoFailoverNoLoadBalancingConcurrent()
        {
            var channel = new DirectChannel(provider, null, "noLoadBalancerNoFailover", null);

            channel.Failover = false;
            handlerA.Setup((h) => h.HandleMessage(message)).Throws(new MessageRejectedException(message, null));
            var dispatcher = channel.Dispatcher;

            dispatcher.AddHandler(handlerA.Object);
            dispatcher.AddHandler(handlerB.Object);

            void MessageSenderTask()
            {
                try
                {
                    start.Wait();
                }
                catch (Exception)
                {
                    throw;
                }

                var sent = false;

                try
                {
                    sent = channel.Send(message);
                }
                catch (Exception e2)
                {
                    exceptionRegistry.Object.Add(e2);
                }

                if (!sent)
                {
                    failed = 1;
                }

                allDone.Signal();
            }

            for (var i = 0; i < TOTAL_EXECUTIONS; i++)
            {
                Task.Run(MessageSenderTask);
            }

            start.Signal();
            Assert.True(allDone.Wait(10000));

            Assert.Equal(1, failed);
            handlerA.Verify((h) => h.HandleMessage(message), Times.Exactly(TOTAL_EXECUTIONS));
            handlerB.Verify((h) => h.HandleMessage(message), Times.Exactly(0));

            exceptionRegistry.Verify((list) => list.Add(It.IsAny <Exception>()), Times.Exactly(TOTAL_EXECUTIONS));
        }
Ejemplo n.º 12
0
        public void testSend()
        {
            DirectChannel channel = new DirectChannel();
            ThreadNameExtractingTestTarget target = new ThreadNameExtractingTestTarget();

            channel.Subscribe(target);
            StringMessage message = new StringMessage("test");

            Assert.IsTrue(channel.Send(message));
            Assert.That(target.ThreadName, Is.EqualTo(Thread.CurrentThread.Name));
        }
Ejemplo n.º 13
0
        public void TestSend()
        {
            var target  = new ThreadNameExtractingTestTarget();
            var channel = new DirectChannel(provider.GetService <IApplicationContext>());

            channel.Subscribe(target);
            var message     = Message.Create("test");
            var currentId   = Task.CurrentId;
            var curThreadId = Thread.CurrentThread.ManagedThreadId;

            Assert.True(channel.Send(message));
            Assert.Equal(currentId, target.TaskId);
            Assert.Equal(curThreadId, target.ThreadId);
        }
Ejemplo n.º 14
0
    public void DirectChannel_Send_10_000_000_SingleHandler()
    {
        var services = new ServiceCollection();

        services.AddSingleton <IIntegrationServices, IntegrationServices>();
        var provider      = services.BuildServiceProvider();
        var directChannel = new DirectChannel(provider);
        var handler       = new CounterHandler();

        directChannel.Subscribe(handler);
        var message = new GenericMessage("test");

        directChannel.Send(message);
        for (var i = 0; i < 10_000_000; i++)
        {
            directChannel.Send(message);
        }

        if (handler.Count != 10_000_000 + 1)
        {
            throw new InvalidOperationException("Handler count invalid");
        }
    }
 public void TestCorrelationIdPassedIfAvailable()
 {
     object correlationId = "123-ABC";
     IMessage message = MessageBuilder.WithPayload("test").SetCorrelationId(correlationId).Build();
     DirectChannel inputChannel = new DirectChannel();
     QueueChannel outputChannel = new QueueChannel(1);
     ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "UpperCase");
     serviceActivator.OutputChannel = outputChannel;
     EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, serviceActivator);
     endpoint.Start();
     Assert.IsTrue(inputChannel.Send(message));
     IMessage reply = outputChannel.Receive(TimeSpan.Zero);
     Assert.That(reply.Headers.CorrelationId, Is.EqualTo(correlationId));
 }
Ejemplo n.º 16
0
        public void testSendInSeparateThread()
        {
            CountDownLatch latch   = new CountDownLatch(1);
            DirectChannel  channel = new DirectChannel();
            ThreadNameExtractingTestTarget target = new ThreadNameExtractingTestTarget(latch);

            channel.Subscribe(target);
            StringMessage message = new StringMessage("test");
            Thread        t       = new Thread(new ThreadStart(delegate { channel.Send(message); }));

            t.Name = "test-thread";
            t.Start();
            latch.Await(new TimeSpan(0, 0, 0, 0, 1000));
            Assert.That(target.ThreadName, Is.EqualTo("test-thread"));
        }
Ejemplo n.º 17
0
        public void TestSendInSeparateThread()
        {
            var latch   = new CountdownEvent(1);
            var channel = new DirectChannel(provider.GetService <IApplicationContext>());
            var target  = new ThreadNameExtractingTestTarget(latch);

            channel.Subscribe(target);
            var message = Message.Create("test");
            var thread  = new Thread(() => channel.Send(message));

            thread.Name = "test-thread";
            thread.Start();
            latch.Wait(1000);
            Assert.Equal("test-thread", target.ThreadName);
        }
        public void TestCorrelationNotCopiedFromRequestMessgeIdIfAlreadySetByHandler()
        {
            IMessage                 message          = new StringMessage("test");
            DirectChannel            inputChannel     = new DirectChannel();
            QueueChannel             outputChannel    = new QueueChannel(1);
            ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "CreateMessage");

            serviceActivator.OutputChannel = outputChannel;
            EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, serviceActivator);

            endpoint.Start();
            Assert.IsTrue(inputChannel.Send(message));
            IMessage reply = outputChannel.Receive(TimeSpan.Zero);

            Assert.That(reply.Headers.CorrelationId, Is.EqualTo("456-XYZ"));
        }
Ejemplo n.º 19
0
        public async Task TestCorrelationNotCopiedFromRequestMessgeIdIfAlreadySetByHandler()
        {
            IMessage message          = Message.Create("test");
            var      inputChannel     = new DirectChannel(provider.GetService <IApplicationContext>());
            var      outputChannel    = new QueueChannel(provider.GetService <IApplicationContext>(), 1);
            var      serviceActivator = new ServiceActivatingHandler(provider.GetService <IApplicationContext>(), new TestBeanCreateMessage());

            serviceActivator.OutputChannel = outputChannel;
            var endpoint = new EventDrivenConsumerEndpoint(provider.GetService <IApplicationContext>(), inputChannel, serviceActivator);
            await endpoint.Start();

            Assert.True(inputChannel.Send(message));
            var reply    = outputChannel.Receive(0);
            var accessor = new IntegrationMessageHeaderAccessor(reply);

            Assert.Equal("456-XYZ", accessor.GetCorrelationId());
        }
        public void TestCorrelationIdCopiedFromMessageCorrelationIdIfAvailable()
        {
            IMessage                 message          = MessageBuilder.WithPayload("test").SetCorrelationId("correlationId").Build();
            DirectChannel            inputChannel     = new DirectChannel();
            QueueChannel             outputChannel    = new QueueChannel(1);
            ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "UpperCase");

            serviceActivator.OutputChannel = outputChannel;
            EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, serviceActivator);

            endpoint.Start();
            Assert.IsTrue(inputChannel.Send(message));
            IMessage reply = outputChannel.Receive(TimeSpan.Zero);

            Assert.That(reply.Headers.CorrelationId, Is.EqualTo(message.Headers.CorrelationId));
            Assert.IsTrue(message.Headers.CorrelationId.Equals(reply.Headers.CorrelationId));
        }
        public void TestCorrelationNotPassedFromRequestHeaderIfAlreadySetByHandler()
        {
            object                   correlationId    = "123-ABC";
            IMessage                 message          = MessageBuilder.WithPayload("test").SetCorrelationId(correlationId).Build();
            DirectChannel            inputChannel     = new DirectChannel();
            QueueChannel             outputChannel    = new QueueChannel(1);
            ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "CreateMessage");

            serviceActivator.OutputChannel = outputChannel;
            EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, serviceActivator);

            endpoint.Start();
            Assert.IsTrue(inputChannel.Send(message));
            IMessage reply = outputChannel.Receive(TimeSpan.Zero);

            Assert.That(reply.Headers.CorrelationId, Is.EqualTo("456-XYZ"));
        }
Ejemplo n.º 22
0
        public void OneChannel()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider             = services.BuildServiceProvider();
            var noSubscribersChannel = new DirectChannel(provider);

            try
            {
                noSubscribersChannel.Send(new GenericMessage <string>("Hello, world!"));
                throw new Exception("Exception expected");
            }
            catch (MessagingException e)
            {
                Assert.Contains("Dispatcher has no subscribers", e.Message);
            }
        }
Ejemplo n.º 23
0
        public async Task TestCorrelationIdPassedIfAvailable()
        {
            object correlationId    = "123-ABC";
            var    message          = Support.MessageBuilder.WithPayload("test").SetCorrelationId(correlationId).Build();
            var    inputChannel     = new DirectChannel(provider);
            var    outputChannel    = new QueueChannel(provider, 1);
            var    serviceActivator = new ServiceActivatingHandler(provider, new TestBeanUpperCase());

            serviceActivator.OutputChannel = outputChannel;
            var endpoint = new EventDrivenConsumerEndpoint(provider, inputChannel, serviceActivator);
            await endpoint.Start();

            Assert.True(inputChannel.Send(message));
            var reply    = outputChannel.Receive(0);
            var accessor = new IntegrationMessageHeaderAccessor(reply);

            Assert.Equal(correlationId, accessor.GetCorrelationId());
        }
Ejemplo n.º 24
0
        public void TestSend()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var target   = new ThreadNameExtractingTestTarget();
            var channel  = new DirectChannel(provider);

            channel.Subscribe(target);
            var message     = new GenericMessage("test");
            var currentId   = Task.CurrentId;
            var curThreadId = Thread.CurrentThread.ManagedThreadId;

            Assert.True(channel.Send(message));
            Assert.Equal(currentId, target.TaskId);
            Assert.Equal(curThreadId, target.ThreadId);
        }
Ejemplo n.º 25
0
        public async Task TestCorrelationNotPassedFromRequestHeaderIfAlreadySetByHandler()
        {
            object correlationId    = "123-ABC";
            var    message          = Support.IntegrationMessageBuilder.WithPayload("test").SetCorrelationId(correlationId).Build();
            var    inputChannel     = new DirectChannel(provider.GetService <IApplicationContext>());
            var    outputChannel    = new QueueChannel(provider.GetService <IApplicationContext>(), 1);
            var    serviceActivator = new ServiceActivatingHandler(provider.GetService <IApplicationContext>(), new TestBeanCreateMessage());

            serviceActivator.OutputChannel = outputChannel;
            var endpoint = new EventDrivenConsumerEndpoint(provider.GetService <IApplicationContext>(), inputChannel, serviceActivator);
            await endpoint.Start();

            Assert.True(inputChannel.Send(message));
            var reply    = outputChannel.Receive(0);
            var accessor = new IntegrationMessageHeaderAccessor(reply);

            Assert.Equal("456-XYZ", accessor.GetCorrelationId());
        }
Ejemplo n.º 26
0
    public void DirectChannel_Send_10_000_000_FourHandlers()
    {
        var services = new ServiceCollection();

        services.AddSingleton <IIntegrationServices, IntegrationServices>();
        var provider = services.BuildServiceProvider();
        var channel  = new DirectChannel(provider.GetService <IApplicationContext>());
        var count1   = new CounterHandler();
        var count2   = new CounterHandler();
        var count3   = new CounterHandler();
        var count4   = new CounterHandler();

        channel.Subscribe(count1);
        channel.Subscribe(count2);
        channel.Subscribe(count3);
        channel.Subscribe(count4);
        var message = Message.Create("test");

        for (var i = 0; i < 10_000_000; i++)
        {
            channel.Send(message);
        }

        if (count1.Count != 10_000_000 / 4)
        {
            throw new InvalidOperationException("Handler count1 invalid");
        }

        if (count2.Count != 10_000_000 / 4)
        {
            throw new InvalidOperationException("Handler count2 invalid");
        }

        if (count3.Count != 10_000_000 / 4)
        {
            throw new InvalidOperationException("Handler count3 invalid");
        }

        if (count4.Count != 10_000_000 / 4)
        {
            throw new InvalidOperationException("Handler count4 invalid");
        }
    }
Ejemplo n.º 27
0
        public void TestSendInSeparateThread()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var latch    = new CountdownEvent(1);
            var channel  = new DirectChannel(provider);
            var target   = new ThreadNameExtractingTestTarget(latch);

            channel.Subscribe(target);
            var message = new GenericMessage("test");
            var thread  = new Thread(() => channel.Send(message));

            thread.Name = "test-thread";
            thread.Start();
            latch.Wait(1000);
            Assert.Equal("test-thread", target.ThreadName);
        }
        public void BridgedChannel()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider             = services.BuildServiceProvider();
            var noSubscribersChannel = new DirectChannel(provider.GetService <IApplicationContext>());
            var subscribedChannel    = new DirectChannel(provider.GetService <IApplicationContext>());
            var bridgeHandler        = new BridgeHandler(provider.GetService <IApplicationContext>());

            bridgeHandler.OutputChannel = noSubscribersChannel;
            subscribedChannel.Subscribe(bridgeHandler);
            try
            {
                subscribedChannel.Send(Message.Create("Hello, world!"));
                throw new Exception("Exception expected");
            }
            catch (MessagingException e)
            {
                Assert.Contains("Dispatcher has no subscribers", e.Message);
            }
        }
Ejemplo n.º 29
0
        public void TestSendFourHandlers_10_000_000()
        {
            var channel = new DirectChannel(provider.GetService <IApplicationContext>());
            var count1  = new CounterHandler();
            var count2  = new CounterHandler();
            var count3  = new CounterHandler();
            var count4  = new CounterHandler();

            channel.Subscribe(count1);
            channel.Subscribe(count2);
            channel.Subscribe(count3);
            channel.Subscribe(count4);
            var message = Message.Create("test");

            for (var i = 0; i < 10000000; i++)
            {
                channel.Send(message);
            }

            Assert.Equal(10000000 / 4, count1.Count);
            Assert.Equal(10000000 / 4, count2.Count);
            Assert.Equal(10000000 / 4, count3.Count);
            Assert.Equal(10000000 / 4, count4.Count);
        }
 public void TestCorrelationNotCopiedFromRequestMessgeIdIfAlreadySetByHandler()
 {
     IMessage message = new StringMessage("test");
     DirectChannel inputChannel = new DirectChannel();
     QueueChannel outputChannel = new QueueChannel(1);
     ServiceActivatingHandler serviceActivator = new ServiceActivatingHandler(new TestBean(), "CreateMessage");
     serviceActivator.OutputChannel = outputChannel;
     EventDrivenConsumer endpoint = new EventDrivenConsumer(inputChannel, serviceActivator);
     endpoint.Start();
     Assert.IsTrue(inputChannel.Send(message));
     IMessage reply = outputChannel.Receive(TimeSpan.Zero);
     Assert.That(reply.Headers.CorrelationId, Is.EqualTo("456-XYZ"));
 }