Skip to content

GH-6129 A broker-per-tenant listener's Kafka retry moves stay on the tenant's cluster - #6135

Open
lahma wants to merge 1 commit into
JasperFx:mainfrom
lahma:gh-6129-kafka-tenant-retry-cluster
Open

lahma wants to merge 1 commit into
JasperFx:mainfrom
lahma:gh-6129-kafka-tenant-retry-cluster

Conversation

@lahma

@lahma lahma commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Under broker-per-tenant, MoveToKafkaRetryTopicContinuation produced through listener.Topic.Parent, the default cluster's transport. A failure on a tenant's listener therefore went to the retry topic on the default cluster. The default cluster's tier listener handled it there, and after the last tier dead-lettered it there too. The tenant cluster's own tier listeners, which AutoProvision() and the tenant-aware tier endpoints already set up, never received anything.

Change

  • KafkaListener's cluster transport (the tenant's own, or else the topic's) is now internal ClusterTransport, which was the private clusterTransport.
  • The continuation produces the retry record through it, as MoveToErrorsAsync already does for dead letters.
  • The retry topic is still resolved on the listener's topic transport, which defines the tier endpoints and their mapper, as the tenant senders do.
  • The guide's "Out of scope" note no longer lists retry topics; replay stays default-cluster only.

No registration change was needed. registerRetryTopicListeners runs before provisionTenantTopicsAsync, so the tier topics are already created on every tenant cluster.

Test

  • KafkaPerTenantConnectionTests.tenant_message_moved_to_a_retry_topic_stays_on_the_tenant_cluster: a tenant message fails once on the source topic and is handled again off the 1 s tier, as tenantB both times.
  • The retry record is on the tenant's cluster and not on the shared one.
  • The test fails without the fix (the record lands on the shared cluster) and passes with it, beside the class's other three tests.

Fixes #6129

🤖 Generated with Claude Code

… on the tenant's cluster

MoveToKafkaRetryTopicContinuation produced through listener.Topic.Parent,
the default cluster's transport, so a failure on a tenant's listener was
moved to the retry topic on the default cluster, retried and dead-lettered
there. The tenant cluster's own tier listeners never received anything.

The retry record is now produced through the cluster the failing listener
consumes, as its dead letters already are. The retry topic is still
resolved on the topic's transport, which defines the tier endpoints. The
tier topics were already provisioned on every tenant cluster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the tenant-cluster retry changes.

No open issues 🎉

What changed in this PR

Fixes #6129 by keeping Kafka retry messages on the tenant’s own cluster, preserving broker-per-tenant isolation.

Changes:

  • Routes retry records through the listener’s cluster transport.
  • Adds regression coverage for tenant identity and retry-record placement.
  • Updates documentation to describe per-tenant retries; replay remains default-cluster only.
File Description
src/​Transports/​Kafka/​Wolverine.Kafka/​Internals/​MoveToKafkaRetryTopicContinuation.cs Produces retries on the listener’s cluster.
src/​Transports/​Kafka/​Wolverine.Kafka/​Internals/​KafkaListener.cs Exposes the cluster transport internally.
src/​Transports/​Kafka/​Wolverine.Kafka.Tests/​KafkaPerTenantConnectionTests.cs Adds tenant-cluster retry regression coverage.
docs/​guide/​messaging/​transports/​kafka.md Clarifies retry support and replay limitations.

Review effort: Balanced

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.

Kafka broker-per-tenant: a tenant's retry-topic moves are written to the default cluster

2 participants