Class BrokerRouting

java.lang.Object
org.springframework.modulith.events.support.BrokerRouting
Direct Known Subclasses:
BrokerRouting.SpelBrokerRouting

public class BrokerRouting extends Object
A BrokerRouting supports RoutingTarget instances that contain values matching the format $target::$key for which both the target and key can be a SpEL expression.
Since:
1.1
Author:
Oliver Drotbohm
  • Field Details

  • Method Details

    • of

      public static BrokerRouting of(RoutingTarget target, EvaluationContext context)
      Creates a new BrokerRouting for the given RoutingTarget and EvaluationContext.
      Parameters:
      target - must not be null.
      context - must not be null.
      Returns:
      will never be null.
    • getTarget

      @Deprecated public String getTarget()
      Deprecated.
      since 1.3, call getTarget(Object) instead.
      Returns the actual routing target.
      Returns:
      will never be null.
    • getTarget

      public String getTarget(Object event)
      Returns the actual routing target for the given event.
      Parameters:
      event - must not be null.
      Returns:
      will never be null.
      Since:
      1.3
    • getKey

      @Nullable public String getKey(Object event)
      Resolves the routing key against the given event. In case the original RoutingTarget contained an expression, the event will be used as root object to evaluate that expression.
      Parameters:
      event - must not be null.
      Returns:
      can be null.