Class FallbackSequencingPolicy<E extends Exception>

java.lang.Object
org.axonframework.messaging.eventhandling.sequencing.FallbackSequencingPolicy<E>
Type Parameters:
E - The type of exception to catch and handle.
All Implemented Interfaces:
SequencingPolicy

public class FallbackSequencingPolicy<E extends Exception> extends Object implements SequencingPolicy
Implementation of SequencingPolicy that provides exception-based fallback behavior. When the delegate policy throws a specified exception type, this implementation will catch it and delegate to a fallback policy.

This allows for composing sequencing strategies where certain policies might fail with exceptions for unsupported event types, falling back to more generic approaches when exceptions occur.

Since:
5.0.0
Author:
Mateusz Nowak
  • Constructor Details

    • FallbackSequencingPolicy

      public FallbackSequencingPolicy(@Nonnull SequencingPolicy delegate, @Nonnull SequencingPolicy fallback, @Nonnull Class<E> exceptionType)
      Initializes a new instance with the given delegate policy, fallback policy, and exceptionType to catch.
      Parameters:
      delegate - The primary policy to attempt sequence identification with first, not null.
      fallback - The fallback policy to use when the delegate throws the specified exception, not null.
      exceptionType - The type of exception to catch from the delegate policy, not null.
      Throws:
      NullPointerException - When any of the parameters is null.
  • Method Details