Class RegisterTenantDescriptorHandlerInterceptor
java.lang.Object
io.axoniq.framework.messaging.multitenancy.api.RegisterTenantDescriptorHandlerInterceptor
- All Implemented Interfaces:
MessageHandlerInterceptor<Message>
@Internal
public class RegisterTenantDescriptorHandlerInterceptor
extends Object
implements MessageHandlerInterceptor<Message>
A
MessageHandlerInterceptor that registers the TenantDescriptor of the handled Message in the
ProcessingContext, so components further down the handling chain route to that tenant without inspecting the
message again.
The tenant is decided by the shared TenantRouter, the same way every other tenant-routing component decides
it. When the router cannot attribute the message to a known tenant, the interceptor logs a warning and proceeds
without registering a TenantDescriptor.
- Since:
- 5.3.0
- Author:
- Jan Galinski, Laura Devriendt
-
Constructor Summary
ConstructorsConstructorDescriptionRegisterTenantDescriptorHandlerInterceptor(TenantRouter tenantRouter) Constructs aRegisterTenantDescriptorHandlerInterceptorregistering the tenant decided by the giventenantRouteronto theProcessingContextof the handledMessage. -
Method Summary
Modifier and TypeMethodDescriptioninterceptOnHandle(Message message, ProcessingContext context, MessageHandlerInterceptorChain<Message> interceptorChain) Intercepts a givenmessageon handling before reaching the designatedMessageHandler.
-
Constructor Details
-
RegisterTenantDescriptorHandlerInterceptor
Constructs aRegisterTenantDescriptorHandlerInterceptorregistering the tenant decided by the giventenantRouteronto theProcessingContextof the handledMessage.- Parameters:
tenantRouter- the router deciding which tenant the handledMessagebelongs to
-
-
Method Details
-
interceptOnHandle
public MessageStream<?> interceptOnHandle(Message message, ProcessingContext context, MessageHandlerInterceptorChain<Message> interceptorChain) Description copied from interface:MessageHandlerInterceptorIntercepts a givenmessageon handling before reaching the designatedMessageHandler. The interceptor is responsible for the continuation of the handling process by invoking theMessageHandlerInterceptorChain.proceed(Message, ProcessingContext)method on the giveninterceptorChain. The givencontextcontains contextual information. Any information gathered by interceptors may be attached to the context. Interceptors are not allowed to change the type of the message handling result, as the dispatching component expects a result of a specific type.- Specified by:
interceptOnHandlein interfaceMessageHandlerInterceptor<Message>- Parameters:
message- The message to intercept on handling.context- The active processing context of themessagebeing processed.interceptorChain- The interceptor chain that allows this interceptor to proceed the dispatch process.- Returns:
- The resulting message stream from
MessageHandlerInterceptorChain.proceed(Message, ProcessingContext).
-