org.axonframework.commandhandling.gateway
Interface RetryScheduler

All Known Implementing Classes:
IntervalRetryScheduler

public interface RetryScheduler

Interface towards a mechanism that decides whether to schedule a command for execution when a previous attempts resulted in an exception.

Since:
2.0
Author:
Allard Buijze

Method Summary
 boolean scheduleRetry(CommandMessage commandMessage, RuntimeException lastFailure, List<Class<? extends Throwable>[]> failures, Runnable commandDispatch)
          Inspect the given commandMessage that failed with given lastFailure.
 

Method Detail

scheduleRetry

boolean scheduleRetry(CommandMessage commandMessage,
                      RuntimeException lastFailure,
                      List<Class<? extends Throwable>[]> failures,
                      Runnable commandDispatch)
Inspect the given commandMessage that failed with given lastFailure. The given failures provides a list of previous failures known for this command. The commandDispatch task can be used to schedule the command for dispatching.

The return value of this method indicates whether the command has been scheduled for a retry. When true, the original callbacks should not be invoked, as command execution is subject to a retry. When false, the failure is interpreted as terminal and the callback will be invoked with the last failure recorded.

If the implementation throws an Exception, that exception is passed as the failure to the original callback.

Parameters:
commandMessage - The Command Message being dispatched
lastFailure - The last failure recorded for this command
failures - A condensed view of all known failures of this command. Each element in the array represents the cause of the element preceding it.
commandDispatch - The task to be executed to retry a command
Returns:
true if the command has been rescheduled, otherwise false


Copyright © 2010-2016. All Rights Reserved.