Class TenantAwareOutboxPoller
TenantSupplier.
For each tenant the poller clears the thread's ContextContainer and runs OutboxDispatcher.poll() inside TenantScope.run(String, Runnable), which sets the tenant and pins it on the
thread. With a tenant-routing DataSource every connection opened while draining (the
claim, the handler's transaction, a REQUIRES_NEW transaction deep inside a handler, the
acknowledgement) therefore goes to that tenant's database, even if code the handler calls changes
the ContextContainer.
A failure while draining one tenant (its database is down, say) is logged and does not stop
the other tenants. The thread's original context is restored after each tenant. With no tenants
(a single-tenant deployment, or no multi-datasource-utils) this is one dispatcher.poll()
in the current context.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OutboxDispatcherprivate static final org.slf4j.Loggerprivate final TenantSupplierprivate final TenantScope -
Constructor Summary
ConstructorsConstructorDescriptionTenantAwareOutboxPoller(OutboxDispatcher dispatcher, TenantSupplier tenants, TenantScope tenantScope) -
Method Summary
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
dispatcher
-
tenants
-
tenantScope
-
-
Constructor Details
-
TenantAwareOutboxPoller
public TenantAwareOutboxPoller(OutboxDispatcher dispatcher, TenantSupplier tenants, TenantScope tenantScope)
-
-
Method Details
-
poll
public void poll()One background polling cycle across all tenants. -
pollTenant
Drains one tenant's outbox; failures are logged, not thrown. -
tenants
-
CHENILE