Class AnnotatedEntityModelRoutingKeyMatcher<E>

java.lang.Object
org.axonframework.modelling.entity.annotation.AnnotatedEntityModelRoutingKeyMatcher<E>
Type Parameters:
E - The type of the entity this matcher is used for.

@Internal public class AnnotatedEntityModelRoutingKeyMatcher<E> extends Object
Utility class that matches an entity instance to a message based on the routing key of a message and the routing key of the entity. The expected payload type of the message is requested from the AnnotatedEntityMetamodel to be able to resolve the payload and extract the requested properties. Once extracted, both routing keys are then compared for a match.
Since:
5.0.0
Author:
Mitchell Herrijgers
  • Constructor Details

    • AnnotatedEntityModelRoutingKeyMatcher

      public AnnotatedEntityModelRoutingKeyMatcher(@Nonnull AnnotatedEntityMetamodel<E> metamodel, @Nonnull String entityRoutingProperty, @Nonnull String messageRoutingProperty)
      Constructs an AnnotatedEntityModelRoutingKeyMatcher that matches the routing key of the given entity against the routing key of a message. The routing key of the entity is determined by the entityRoutingProperty and the routing key of the message is determined by the messageRoutingProperty.
      Parameters:
      metamodel - The AnnotatedEntityMetamodel of the entity to match against.
      entityRoutingProperty - The routing key property of the entity, which is used to match against the message routing key.
      messageRoutingProperty - The routing key property of the message, which is used to match against the entity routing key.
  • Method Details

    • matches

      public boolean matches(@Nonnull E entity, @Nonnull Message message)
      Matches the given entity against the provided message based on the routing keys of both. The routing key of the message is extracted from the expected payload type of the message, and compared to the routing key of the entity.
      Parameters:
      entity - The entity to match against.
      message - The message to match against.
      Returns:
      true if the routing keys match, false otherwise.