org.axonframework.eventhandling.async
Class RetryPolicy

java.lang.Object
  extended by org.axonframework.eventhandling.async.RetryPolicy
Direct Known Subclasses:
EventProcessor.ProcessingResult

public abstract class RetryPolicy
extends Object

This policy tells the EventProcessor how it should deal with failed transactions.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
RetryPolicy()
           
 
Method Summary
static RetryPolicy proceed()
          Tells the scheduler to ignore the failure continue processing.
abstract  boolean requiresRescheduleEvent()
          Indicates whether the scheduler should reschedule the failed event.
abstract  boolean requiresRollback()
          Indicates whether the scheduler should rollback the Unit of Work wrapping the event handling.
static RetryPolicy retryAfter(long timeout, TimeUnit unit)
          This policy will roll back the Unit of Work (and the transaction), if any) and reschedule the event for processing.
static RetryPolicy skip()
          This policy will roll back the Unit of Work (and the transaction) and skip the event altogether.
abstract  long waitTime()
          Returns the time the scheduler should wait before continuing processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetryPolicy

public RetryPolicy()
Method Detail

proceed

public static RetryPolicy proceed()
Tells the scheduler to ignore the failure continue processing. The Event is processed by the remaining Event Listeners in the Cluster.

Returns:
A RetryPolicy instance requesting the scheduler to proceed with dispatching

skip

public static RetryPolicy skip()
This policy will roll back the Unit of Work (and the transaction) and skip the event altogether. When all listeners support the type of transaction backed by the Unit of Work, this effectively means that the Event can be regarded as not processed. The Event will not be handled by any remaining Event Listeners in the Cluster.

Returns:
A RetryPolicy instance requesting the scheduler to rollback the Unit of Work and continue processing the next Event.

retryAfter

public static RetryPolicy retryAfter(long timeout,
                                     TimeUnit unit)
This policy will roll back the Unit of Work (and the transaction), if any) and reschedule the event for processing. The Event will not be handled by any remaining Event Listeners in the Cluster.

Parameters:
timeout - The amount of time to wait before retrying
unit - The unit of time for the timeout
Returns:
a RetryPolicy requesting a rollback and a retry of the failed Event after the given timeout

waitTime

public abstract long waitTime()
Returns the time the scheduler should wait before continuing processing. This value is ignored if requiresRescheduleEvent() returns false.

Returns:
the amount of time, in milliseconds, the scheduler should wait before continuing processing.

requiresRescheduleEvent

public abstract boolean requiresRescheduleEvent()
Indicates whether the scheduler should reschedule the failed event.

Returns:
true if the scheduler should reschedule the failed event, otherwise false

requiresRollback

public abstract boolean requiresRollback()
Indicates whether the scheduler should rollback the Unit of Work wrapping the event handling.

Returns:
true to indicate the scheduler should perform a rollback or false to request a commit.


Copyright © 2010-2016. All Rights Reserved.