Пример #1
0
        public void Deserialization_Error_Will_Not_Retry()
        {
            var serviceLocator = new CastleServiceLocator(new WindsorContainer());
            messageSerializer = new ThrowingSerializer(new XmlMessageSerializer(new DefaultReflection(),
                                                      serviceLocator));
            transport = new RhinoQueuesTransport(
                new Uri("rhino.queues://localhost:23456/q"),
                new EndpointRouter(),
                messageSerializer,
                1,
                "test.esent",
                IsolationLevel.Serializable,
                5,
                false,
                new RhinoQueuesMessageBuilder(messageSerializer, serviceLocator),
                new QueueManagerConfiguration()
                );
            transport.Start();
            var count = 0;
            transport.MessageProcessingFailure += (messageInfo, ex) =>
            {
                count++;
            };
            transport.Send(transport.Endpoint, new object[] { "test" });

            wait.WaitOne(TimeSpan.FromSeconds(5));

            Assert.Equal(1, count);
        }
Пример #2
0
        public void Arrived_Error_Will_Retry_Number_Of_Times_Configured()
        {
            messageSerializer = new XmlMessageSerializer(new DefaultReflection(), new DefaultKernel());
            transport = new RhinoQueuesTransport(
                new Uri("rhino.queues://localhost:23456/q"),
                new EndpointRouter(),
                messageSerializer,
                1,
                "test.esent",
                IsolationLevel.Serializable,
                5,
                new RhinoQueuesMessageBuilder(messageSerializer)
                );
            transport.Start();
            var count = 0;
            transport.MessageArrived += info =>
            {
                throw new InvalidOperationException();
            };
            transport.MessageProcessingFailure += (messageInfo, ex) =>
            {
                count++;
            };
            transport.Send(transport.Endpoint, new object[] { "test" });

            wait.WaitOne(TimeSpan.FromSeconds(5));

            Assert.Equal(5, count);
        }