Class AbstractRoutingStrategy

java.lang.Object
org.axonframework.commandhandling.distributed.AbstractRoutingStrategy
All Implemented Interfaces:
RoutingStrategy
Direct Known Subclasses:
AnnotationRoutingStrategy, MetaDataRoutingStrategy

public abstract class AbstractRoutingStrategy extends Object implements RoutingStrategy
Abstract implementation of the RoutingStrategy interface that includes a fallback RoutingStrategy which prescribes what happens when routing cannot be resolved by this implementation.
Since:
2.0
Author:
Allard Buijze
  • Constructor Details

    • AbstractRoutingStrategy

      @Deprecated public AbstractRoutingStrategy(@Nonnull UnresolvedRoutingKeyPolicy fallbackRoutingStrategy)
      Initializes the strategy using given UnresolvedRoutingKeyPolicy prescribing the fallback approach when this implementation cannot resolve a routing key.
      Parameters:
      fallbackRoutingStrategy - the fallback routing to use whenever this RoutingStrategy doesn't succeed
    • AbstractRoutingStrategy

      protected AbstractRoutingStrategy(@Nonnull RoutingStrategy fallbackRoutingStrategy)
      Initializes the strategy using given RoutingStrategy prescribing the fallback approach when this implementation cannot resolve a routing key.
      Parameters:
      fallbackRoutingStrategy - the fallback routing to use whenever this RoutingStrategy doesn't succeed
  • Method Details

    • getRoutingKey

      public String getRoutingKey(@Nonnull CommandMessage<?> command)
      Description copied from interface: RoutingStrategy
      Generates a routing key for the given command. Commands that should be handled by the same segment, should result in the same routing key.
      Specified by:
      getRoutingKey in interface RoutingStrategy
      Parameters:
      command - the command to create a routing key for
      Returns:
      the routing key for the command
    • doResolveRoutingKey

      protected abstract String doResolveRoutingKey(@Nonnull CommandMessage<?> command)
      Resolve the Routing Key for the given command.
      Parameters:
      command - the command to resolve the routing key for
      Returns:
      the String representing the Routing Key, or null if unresolved