Пример #1
0
        public UsingRhinoFilesTransport()
        {
            if (Directory.Exists("test.esent"))
                Directory.Delete("test.esent", true);

            var serviceLocator = new CastleServiceLocator(new WindsorContainer());
            messageSerializer = new XmlMessageSerializer(new DefaultReflection(), serviceLocator);
            transport = new RhinoFilesTransport(
                new Uri("file://localhost/q"),
                new EndpointRouter(),
                messageSerializer,
                1,
                "test.esent",
                IsolationLevel.Serializable,
                5,
                false,
                new RhinoFilesMessageBuilder(messageSerializer, serviceLocator),
                new QueueManagerConfiguration()
                );
            transport.Start();
        }
Пример #2
0
        public void Arrived_Error_Will_Retry_Number_Of_Times_Configured()
        {
            var serviceLocator = new CastleServiceLocator(new WindsorContainer());
            messageSerializer = new XmlMessageSerializer(new DefaultReflection(), serviceLocator);
            transport = new RhinoFilesTransport(
                new Uri("file://localhost/q"),
                new EndpointRouter(),
                messageSerializer,
                1,
                "test.esent",
                IsolationLevel.Serializable,
                5,
                false,
                new RhinoFilesMessageBuilder(messageSerializer, serviceLocator),
                new QueueManagerConfiguration()
                );
            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);
        }