Skip to content

Fix deduplication cleanup under multi-tenant with no default connection (#667)#670

Merged
dgafka merged 1 commit into
mainfrom
fix/667-dedup-cleanup-multitenant-no-default
May 26, 2026
Merged

Fix deduplication cleanup under multi-tenant with no default connection (#667)#670
dgafka merged 1 commit into
mainfrom
fix/667-dedup-cleanup-multitenant-no-default

Conversation

@dgafka
Copy link
Copy Markdown
Member

@dgafka dgafka commented May 26, 2026

Why is this change proposed?

Fixes #667ecotone:deduplication:remove-expired-messages fails under a multi-tenant
connection setup that has no default connection.

With MultiTenantConfiguration and no default connection, running the cleanup command throws:

Lack of context about tenant in Message Headers. Please add `tenantId` header metadata to your message.
  at HeaderBasedMultiTenantConnectionFactory.php:105

Description of Changes

# Symfony
bin/console ecotone:deduplication:remove-expired-messages --header tenantId:tenant_a
# Laravel
php artisan ecotone:deduplication:remove-expired-messages --header=tenantId:tenant_a

Run once per tenant (e.g. from the scheduler) to clean each tenant's ecotone_deduplication table.

Pull Request Contribution Terms

  • I have read and agree to the contribution terms outlined in CONTRIBUTING.

…on (#667)

Console commands were dispatched via MessagingEntrypointService::sendWithHeaders(),
which sets headers on the message but does not push them onto the propagated-header
context. HeaderBasedMultiTenantConnectionFactory resolves the tenant only from that
context, so a CLI --header tenantId:<tenant> was invisible to it and the cleanup
command threw under a multi-tenant setup with no default connection.

Dispatch console commands via sendWithHeadersPropagation() so CLI-supplied headers
participate in propagation, consistent with the command/event buses. This enables
tenant-aware console commands, e.g. running the deduplication cleanup once per tenant
with --header tenantId:<tenant>.
@dgafka dgafka merged commit fb72f07 into main May 26, 2026
10 of 11 checks passed
@dgafka dgafka deleted the fix/667-dedup-cleanup-multitenant-no-default branch May 26, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deduplication clean up fails in multi tenant connection setup with no default

1 participant