Class AttachTenantDescriptorDispatchInterceptor

java.lang.Object
io.axoniq.framework.messaging.multitenancy.api.AttachTenantDescriptorDispatchInterceptor
All Implemented Interfaces:
MessageDispatchInterceptor<Message>

@Internal public class AttachTenantDescriptorDispatchInterceptor extends Object implements MessageDispatchInterceptor<Message>
A MessageDispatchInterceptor that attaches the tenant of the dispatching ProcessingContext onto a dispatched command or query, so it stays attributable to that tenant once it crosses a distributed command or query bus and arrives in a fresh ProcessingContext on the receiving side.

The tenant is decided by the shared TenantRouter, the same way every other tenant-routing component decides it. When the dispatching context carries no tenant, for example because the message is dispatched outside of any handler, this interceptor does nothing.

The dispatch-side counterpart of RegisterTenantDescriptorHandlerInterceptor: that interceptor registers the tenant of a handled message onto the ProcessingContext; this one attaches that same tenant onto a message dispatched from within that handling, so a receiving component can resolve it without the message having named a tenant of its own.

Since:
5.3.0
Author:
Jakob Hatzl