Interface TargetContextResolver<T extends Message>
- Type Parameters:
T- the type ofMessageto 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.
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 TypeMethodDescriptionstatic TargetContextResolver<Message> noOp()Returns a no-op TargetContextResolver.default TargetContextResolver<T> orElse(TargetContextResolver<? super T> other) Returns a TargetContextResolver that usesthisinstance to resolve a context for a given message and if it returnsnull, returns the results of theotherresolver instead.resolveContext(T message) Provides the context to which a message should be routed.
-
Method Details
-
resolveContext
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
nullif the message does not specify any context
-
orElse
Returns a TargetContextResolver that usesthisinstance to resolve a context for a given message and if it returnsnull, returns the results of theotherresolver instead.- Parameters:
other- the resolver that will provide a context ifthisdoesn't return one- Returns:
- a TargetContextResolver that resolves the context from either
this, or theother
-
noOp
Returns a no-op TargetContextResolver. This will default to returningnullon anyMessageprovided.- Returns:
- a no-op TargetContextResolver. This will default to returning
nullon anyMessageprovided
-