public void things_are_received_at_the_right_times()
        {
            TestMessageRecorder.AllProcessed.Any().ShouldBeFalse();

            theProcessor.Execute(new CancellationToken());
            Thread.Sleep(2000);
            TestMessageRecorder.AllProcessed.Any().ShouldBeFalse();

            theClock.LocalNow(theClock.LocalTime().Add(61.Minutes()));
            theProcessor.Execute(new CancellationToken());

            Wait.Until(() => TestMessageRecorder.HasProcessed(message1)).ShouldBeTrue();
            Wait.Until(() => TestMessageRecorder.HasProcessed(message2)).ShouldBeTrue();

            TestMessageRecorder.HasProcessed(message3).ShouldBeFalse();
            TestMessageRecorder.HasProcessed(message4).ShouldBeFalse();

            theClock.LocalNow(theClock.LocalTime().Add(61.Minutes()));
            theProcessor.Execute(new CancellationToken());

            Wait.Until(() => TestMessageRecorder.HasProcessed(message3)).ShouldBeTrue();
            Wait.Until(() => TestMessageRecorder.HasProcessed(message4)).ShouldBeTrue();

            // If it's more than this, we got problems
            TestMessageRecorder.AllProcessed.Count().ShouldEqual(4);
        }
        public void requeues_then_moves_to_error_queue()
        {
            Wait.Until(() => TestMessageRecorder.HasProcessed(message1)).ShouldBeTrue();
            Wait.Until(() => TestMessageRecorder.AllProcessed.Length == 5).ShouldBeTrue();

            var scope   = _queueManager.BeginTransactionalScope();
            var message = scope.Receive(LightningQueuesTransport.ErrorQueueName, 5.Seconds());

            message.ShouldNotBeNull();


            var report = ErrorReport.Deserialize(message.Data);

            message.Headers.Get("ExceptionType").ShouldEqual("System.InvalidOperationException");
            report.RawData.ShouldNotBeNull();
        }
Exemplo n.º 3
0
        public async Task requeues_then_moves_to_error_queue()
        {
            Wait.Until(() => TestMessageRecorder.HasProcessed(message1)).ShouldBeTrue();

            //todo need timeout
            var messageContext = await _queueManager.Receive(LightningQueuesTransport.ErrorQueueName).FirstAsync();

            var message = messageContext.Message;

            message.ShouldNotBeNull();


            var report = ErrorReport.Deserialize(message.Data);

            message.Headers.Get("ExceptionType").ShouldBe("System.InvalidOperationException");
            report.RawData.ShouldNotBeNull();
        }