Interface TargetContextResolver<T extends Message>

Type Parameters:
T - the type of Message to resolve the context for
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 TargetContextResolver<T extends Message>
Interface towards a mechanism that is capable of resolving the context name to which a Message should be routed. This is used in multi-context situations, where certain Messages need to be routed to another "Bounded Context" than the one the application itself is registered in.
Since:
4.2
Author:
Allard Buijze
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a no-op TargetContextResolver.
    orElse(TargetContextResolver<? super T> other)
    Returns a TargetContextResolver that uses this instance to resolve a context for a given message and if it returns null, returns the results of the other resolver instead.
    resolveContext(T message)
    Provides the context to which a message should be routed.
  • Method Details

    • resolveContext

      String resolveContext(T message)
      Provides the context to which a message should be routed.
      Parameters:
      message - the message to resolve the context for
      Returns:
      the name of the context this message should be routed to or null if the message does not specify any context
    • orElse

      default TargetContextResolver<T> orElse(TargetContextResolver<? super T> other)
      Returns a TargetContextResolver that uses this instance to resolve a context for a given message and if it returns null, returns the results of the other resolver instead.
      Parameters:
      other - the resolver that will provide a context if this doesn't return one
      Returns:
      a TargetContextResolver that resolves the context from either this, or the other
    • noOp

      Returns a no-op TargetContextResolver. This will default to returning null on any Message provided.
      Returns:
      a no-op TargetContextResolver. This will default to returning null on any Message provided