public bool Handle(TransportMessage message)
        {
            var defer = RetryPolicy.Invoke(message);

            if (defer < TimeSpan.Zero)
            {
                SendToErrorQueue(message);
                return(true);
            }

            Defer(defer, message);

            return(true);
        }
        public void Should_prevent_a_second_retry()
        {
            var delay = RetryPolicy.Invoke(FailingMessage, Exception, 2);

            Assert.AreEqual(TimeSpan.MinValue, delay, "Second Retry should be prevented");
        }
        public void Should_schedule_first_retry()
        {
            var delay = RetryPolicy.Invoke(FailingMessage, Exception, 1);

            Assert.AreEqual(TimeIncrease, delay, "First retry should be attempted after a single timeIncrease interval");
        }
Beispiel #4
0
        public void Should_prevent_subsequent_retries()
        {
            var delay = RetryPolicy.Invoke(FailingMessage, Exception, NumberOfRetries + 1);

            Assert.AreEqual(TimeSpan.MinValue, delay, $"{NumberOfRetries + 1} should not be allowed");
        }
Beispiel #5
0
        public void Should_allow_at_least_that_many_retries()
        {
            var delay = RetryPolicy.Invoke(FailingMessage, Exception, NumberOfRetries);

            Assert.AreNotEqual(TimeSpan.MinValue, delay, $"{NumberOfRetries} retries should be allowed");
        }