org.axonframework.commandhandling.gateway
Class RetryingCallback<R>

java.lang.Object
  extended by org.axonframework.commandhandling.gateway.RetryingCallback<R>
Type Parameters:
R - The type of return value expected by the callback
All Implemented Interfaces:
CommandCallback<R>

public class RetryingCallback<R>
extends Object
implements CommandCallback<R>

Callback implementation that will invoke a retry scheduler if a command results in a runtime exception.

Generally, it is not necessary to use this class directly. It is used by CommandGateway implementations to support retrying of commands.

Since:
2.0
Author:
Allard Buijze
See Also:
DefaultCommandGateway

Constructor Summary
RetryingCallback(CommandCallback<R> delegate, CommandMessage commandMessage, RetryScheduler retryScheduler, CommandBus commandBus)
          Initialize the RetryingCallback with the given delegate, representing the actual callback passed as a parameter to dispatch, the given commandMessage, retryScheduler and commandBus.
 
Method Summary
 void onFailure(Throwable cause)
          Invoked when command handling execution resulted in an error.
 void onSuccess(R result)
          Invoked when command handling execution was successful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetryingCallback

public RetryingCallback(CommandCallback<R> delegate,
                        CommandMessage commandMessage,
                        RetryScheduler retryScheduler,
                        CommandBus commandBus)
Initialize the RetryingCallback with the given delegate, representing the actual callback passed as a parameter to dispatch, the given commandMessage, retryScheduler and commandBus.

Parameters:
delegate - The callback to invoke when the command succeeds, or when retries are rejected.
commandMessage - The message being dispatched
retryScheduler - The scheduler that decides if and when a retry should be scheduled
commandBus - The commandBus on which the command must be dispatched
Method Detail

onSuccess

public void onSuccess(R result)
Description copied from interface: CommandCallback
Invoked when command handling execution was successful.

Specified by:
onSuccess in interface CommandCallback<R>
Parameters:
result - The result of the command handling execution, if any.

onFailure

public void onFailure(Throwable cause)
Description copied from interface: CommandCallback
Invoked when command handling execution resulted in an error.

Specified by:
onFailure in interface CommandCallback<R>
Parameters:
cause - The exception raised during command handling


Copyright © 2010-2016. All Rights Reserved.