Class ForwardMatchingInstances<T extends Message<?>>

java.lang.Object
org.axonframework.modelling.command.ForwardMatchingInstances<T>
Type Parameters:
T - the implementation T of the Message being filtered.
All Implemented Interfaces:
ForwardingMode<T>

public class ForwardMatchingInstances<T extends Message<?>> extends Object implements ForwardingMode<T>
Only forward messages of type T if the routing key of the message matches that of the entity. Essentially, this means that events are only forwarded if the Message mentions the identifier of the entity instance.
Since:
3.1
Author:
Steven van Beelen
  • Constructor Details

    • ForwardMatchingInstances

      public ForwardMatchingInstances()
  • Method Details

    • initialize

      public void initialize(@Nonnull Member member, @Nonnull EntityModel childEntity)
      Description copied from interface: ForwardingMode
      Initializes an instance of a ForwardingMode.
      Specified by:
      initialize in interface ForwardingMode<T extends Message<?>>
      Parameters:
      member - The Member to apply a ForwardingMode on. Provided to be able to check for annotations attributes which might assist in the forwarding process.
      childEntity - A EntityModel constructed from the given field.
    • filterCandidates

      public <E> Stream<E> filterCandidates(@Nonnull T message, @Nonnull Stream<E> candidates)
      Description copied from interface: ForwardingMode
      Filter the given Stream of candidates which are to handle the supplied message.
      Specified by:
      filterCandidates in interface ForwardingMode<T extends Message<?>>
      Type Parameters:
      E - The type of the candidates
      Parameters:
      message - The message of type T to be forwarded.
      candidates - The Stream of candidates to filter.
      Returns:
      a filtered Stream of candidates which will handle the message.