public override void Configure(HandlerChain chain)
        {
            chain.MaximumAttempts = 3;
            chain.OnException <DivideByZeroException>().Requeue();
            chain.OnException <InvalidOperationException>().Retry();

            chain.OnException <NotSupportedException>()
            .MoveToErrorQueue()
            .Then.RespondWithMessage((ex, env) => new ErrorMessage {
                Message = ex.Message
            });
        }
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 5;
     handlerChain.OnException<UnauthorizedAccessException>()
         .ContinueWith<CounterContinuation>()
         .Then.Retry();
 }
Ejemplo n.º 3
0
 // This method signature is meaningful
 public static void Configure(HandlerChain chain)
 {
     // Requeue on IOException for a maximum
     // of 3 attempts
     chain.OnException <IOException>()
     .Requeue(3);
 }
Ejemplo n.º 4
0
        public static void Configure(HandlerChain chain)
        {
            chain.OnException <IOException>()
            .Requeue();

            chain.MaximumAttempts = 3;
        }
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 5;
     handlerChain.OnException <UnauthorizedAccessException>()
     .ContinueWith <CounterContinuation>()
     .Then.Retry();
 }
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 2;
     handlerChain.OnException<UnauthorizedAccessException>()
         .RespondWithMessage((ex, envelope) => new RespondToSender(new ErrorResponse { Message = ex.Message }))
         .Then.MoveToErrorQueue();
 }
        public void move_to_error_queue()
        {
            var chain = new HandlerChain();

            chain.OnException <NotSupportedException>()
            .MoveToErrorQueue();

            chain.ErrorHandlers.Single().As <ErrorHandler>().Sources.Single().ShouldBeOfType <MoveToErrorQueueHandler <NotSupportedException> >();
        }
Ejemplo n.º 8
0
        public override void Configure(HandlerChain handlerChain)
        {
            //when retrying, do so a maximum of 5 times
            handlerChain.MaximumAttempts = 3;

            //retry now
            handlerChain.OnException <DivideByZeroException>()
            .RetryLater(5.Seconds());
        }
Ejemplo n.º 9
0
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 2;
     handlerChain.OnException <UnauthorizedAccessException>()
     .RespondWithMessage((ex, envelope) => new RespondToSender(new ErrorResponse {
         Message = ex.Message
     }))
     .Then.MoveToErrorQueue();
 }
        public void respond_with_message()
        {
            var chain = new HandlerChain();

            chain.OnException<NotImplementedException>()
                .RespondWithMessage((ex, env) => new object());

            chain.ErrorHandlers.Single().ShouldBeOfType<RespondWithMessageHandler<NotImplementedException>>();
        }
        public void move_to_error_queue()
        {
            var chain = new HandlerChain();

            chain.OnException<NotSupportedException>()
                .MoveToErrorQueue();

            chain.ErrorHandlers.Single().ShouldBeOfType<MoveToErrorQueueHandler<NotSupportedException>>();
        }
        public void respond_with_message()
        {
            var chain = new HandlerChain();

            chain.OnException <NotImplementedException>()
            .RespondWithMessage((ex, env) => new object());

            chain.ErrorHandlers.Single().As <ErrorHandler>().Sources.Single().ShouldBeOfType <RespondWithMessageHandler <NotImplementedException> >();
        }
        public void requeue()
        {
            var chain = new HandlerChain();

            chain.OnException<NotSupportedException>()
                .Requeue();

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType<ErrorHandler>();
            handler.Conditions.Single().ShouldBeOfType<ExceptionTypeMatch<NotSupportedException>>();
            handler.Continuation().ShouldBeOfType<RequeueContinuation>();
        }
        public void retry_later()
        {
            var chain = new HandlerChain();

            chain.OnException<NotSupportedException>()
                .RetryLater(10.Minutes());

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType<ErrorHandler>();
            handler.Conditions.Single().ShouldBeOfType<ExceptionTypeMatch<NotSupportedException>>();
            handler.Continuation().ShouldBeOfType<DelayedRetryContinuation>()
                .Delay.ShouldEqual(10.Minutes());
        }
        public void requeue()
        {
            var chain = new HandlerChain();

            chain.OnException <NotSupportedException>()
            .Requeue();

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType <ErrorHandler>();

            handler.Conditions.Single().ShouldBeOfType <ExceptionTypeMatch <NotSupportedException> >();
            handler.Continuation(null, null).ShouldBeOfType <RequeueContinuation>();
        }
        public void retry_now()
        {
            var chain = new HandlerChain();

            chain.OnException <NotImplementedException>()
            .Retry();

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType <ErrorHandler>();

            handler.Conditions.Single().ShouldBeOfType <ExceptionTypeMatch <NotImplementedException> >();
            handler.Continuation(null, null).ShouldBeOfType <RetryNowContinuation>();
        }
        public void retry_later()
        {
            var chain = new HandlerChain();

            chain.OnException <NotSupportedException>()
            .RetryLater(10.Minutes());

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType <ErrorHandler>();

            handler.Conditions.Single().ShouldBeOfType <ExceptionTypeMatch <NotSupportedException> >();
            handler.Continuation(null, null).ShouldBeOfType <DelayedRetryContinuation>()
            .Delay.ShouldBe(10.Minutes());
        }
Ejemplo n.º 18
0
        public override void Configure(HandlerChain handlerChain)
        {
            //when retrying, do so a maximum of 5 times
            handlerChain.MaximumAttempts = 5;

            //retry now
            handlerChain.OnException<ConcurrencyException>()
                .Retry();

            //retry again 5 seconds from now
            handlerChain.OnException<ConcurrencyException>()
                .RetryLater(TimeSpan.FromSeconds(5));

            //immediately move the error and original message to
            //the error queue
            handlerChain.OnException<FileNotFoundException>()
                .MoveToErrorQueue();

            //retries, but puts at the end of the line allowing other
            //messages to be processed
            handlerChain.OnException<Exception>()
                .Requeue();
        }
Ejemplo n.º 19
0
        public override void Configure(HandlerChain handlerChain)
        {
            //when retrying, do so a maximum of 5 times
            handlerChain.MaximumAttempts = 5;

            //retry now
            handlerChain.OnException <ConcurrencyException>()
            .Retry();

            //retry again 5 seconds from now
            handlerChain.OnException <ConcurrencyException>()
            .RetryLater(TimeSpan.FromSeconds(5));

            //immediately move the error and original message to
            //the error queue
            handlerChain.OnException <FileNotFoundException>()
            .MoveToErrorQueue();

            //retries, but puts at the end of the line allowing other
            //messages to be processed
            handlerChain.OnException <Exception>()
            .Requeue();
        }
        public void add_multiple_continuations()
        {
            var chain = new HandlerChain();

            chain.OnException<NotSupportedException>()
                .RetryLater(10.Minutes())
                .Then
                .ContinueWith<TellTheSenderHeSentSomethingWrong>();

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType<ErrorHandler>();
            var continuation = handler.Continuation().ShouldBeOfType<CompositeContinuation>();
            continuation.Select(x => x.GetType())
                .ShouldHaveTheSameElementsAs(typeof(DelayedRetryContinuation), typeof(TellTheSenderHeSentSomethingWrong));
        }
        public void add_multiple_continuations()
        {
            var chain = new HandlerChain();

            chain.OnException <NotSupportedException>()
            .RetryLater(10.Minutes())
            .Then
            .ContinueWith <TellTheSenderHeSentSomethingWrong>();

            var handler      = chain.ErrorHandlers.Single().ShouldBeOfType <ErrorHandler>();
            var continuation = handler.Continuation(null, null).ShouldBeOfType <CompositeContinuation>();

            continuation.Select(x => x.GetType())
            .ShouldHaveTheSameElementsAs(typeof(DelayedRetryContinuation), typeof(TellTheSenderHeSentSomethingWrong));
        }
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 5;
     handlerChain.OnException <InvalidOperationException>()
     .Requeue();
 }
Ejemplo n.º 23
0
 public static void Configure(HandlerChain chain)
 {
     chain.OnException(e => true).Requeue(1000);
 }
 public override void Configure(HandlerChain chain)
 {
     chain.MaximumAttempts = 3;
     chain.OnException <DivideByZeroException>().Requeue();
     chain.OnException <InvalidOperationException>().Retry();
 }
Ejemplo n.º 25
0
 public override void Modify(HandlerChain chain)
 {
     chain.OnException(_exceptionType).Requeue();
 }
Ejemplo n.º 26
0
 public override void Modify(HandlerChain chain)
 {
     chain.OnException(_exceptionType).MoveToErrorQueue();
 }
 public override void Configure(HandlerChain chain)
 {
     chain.MaximumAttempts = 5;
     chain.OnException <TimeoutException>().Retry();
     chain.OnException <DBConcurrencyException>().Retry();
 }
        public void retry_now()
        {
            var chain = new HandlerChain();

            chain.OnException<NotImplementedException>()
                .Retry();

            var handler = chain.ErrorHandlers.Single().ShouldBeOfType<ErrorHandler>();
            handler.Conditions.Single().ShouldBeOfType<ExceptionTypeMatch<NotImplementedException>>();
            handler.Continuation().ShouldBeOfType<RetryNowContinuation>();
        }
Ejemplo n.º 29
0
 public override void Modify(HandlerChain chain)
 {
     chain.OnException(_exceptionType).RetryLater(_seconds.Seconds());
 }
Ejemplo n.º 30
0
 public override void Modify(HandlerChain chain, JasperGenerationRules rules)
 {
     chain.OnException(_exceptionType).RetryLater(_seconds.Seconds());
 }
Ejemplo n.º 31
0
 public override void Modify(HandlerChain chain, JasperGenerationRules rules)
 {
     chain.OnException(_exceptionType).MoveToErrorQueue();
 }
 public override void Configure(HandlerChain handlerChain)
 {
     handlerChain.MaximumAttempts = 5;
     handlerChain.OnException<DBConcurrencyException>()
         .Retry();
 }
Ejemplo n.º 33
0
 public override void Modify(HandlerChain chain, JasperGenerationRules rules)
 {
     chain.OnException(_exceptionType).Retry();
 }