Interface EventTargetMatcher<E>

Type Parameters:
E - The type of entity this matcher is applied to.
All Known Implementing Classes:
RoutingKeyEventTargetMatcher
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface EventTargetMatcher<E>
Functional interface that determines if a given entity should be targeted for a specific EventMessage. Typically used to test whether an entity qualifies to process an event and evolve its state accordingly.

Before version 5.0.0, this interface was known as org.axonframework.modelling.command.ForwardingMode. The interface is now a predicate, instead of a function that returns a part of a list. This allows for more flexible and efficient matching of entities against events in a processing context.

Since:
3.1
Author:
Steven van Beelen, Mitchell Herrijgers
  • Method Details

    • matches

      boolean matches(@Nonnull E targetEntity, @Nonnull EventMessage message, @Nonnull ProcessingContext processingContext)
      Tests whether the given entity should be evolved for the given EventMessage.
      Parameters:
      targetEntity - The entity of type E to test.
      message - The EventMessage to test.
      processingContext - The ProcessingContext in which the message is being processed.
      Returns:
      true if the entity should be invoked for the message, false otherwise.
    • MATCH_ANY

      static <E> EventTargetMatcher<E> MATCH_ANY()
      Returns a matcher that matches any entity, meaning it will always return true for any entity and EventMessage.
      Type Parameters:
      E - The type of the entity to match.
      Returns:
      An EventTargetMatcher that matches any entity.