Repository navigation
Conversation
…etry tiers
RetryTierSourceTopics took the source topics from KafkaTransport.Topics
only, and a ListenToKafkaTopics(...) group lives in TopicGroups, so its
topics got no retry-tier listeners. MoveToKafkaRetryTopic still applied to
the group's listener: a failure was produced to {topic}.retry.{delay} and
the source offset committed, and on a cluster that auto-creates topics
nothing ever read the record again.
The topics of every listening group are now tier sources too, each with
the group's native dead letter setting. The setting is looked up without
the Topics indexer, which would register an endpoint for each topic of the
group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Retry endpoints can apply the wrong dead-letter policy across listeners sharing a topic and lose group-bound sticky handlers, causing misrouted failures or handler-resolution exceptions.
2 open issues
What changed in this PR
Extends Wolverine’s Kafka retry tiers to ListenToKafkaTopics(...) groups, addressing GH-6127’s unconsumed retry messages.
Changes:
- Includes group topics as retry sources, deduplicating overlapping subscriptions.
- Copies source-listener native dead-letter settings to retry tiers.
- Adds regression tests and documents group support.
| File | Description |
|---|---|
| src/Transports/Kafka/Wolverine.Kafka/Internals/KafkaTransport.cs | Includes group topics and resolves source-listener dead-letter settings. |
| src/Transports/Kafka/Wolverine.Kafka.Tests/kafka_retry_topics_for_topic_groups_6127.cs | Tests source discovery, deduplication, retries, and dead-letter delivery. |
| docs/guide/messaging/transports/kafka.md | Clarifies that group topics receive retry tiers. |
Review effort: Balanced
| return Topics.TryFind(topicName, out var topic) && topic.IsListener | ||
| ? topic | ||
| : TopicGroups.First(g => g.IsListener && g.TopicNames.Contains(topicName)); |
There was a problem hiding this comment.
Each tier is one endpoint per topic and delay, so it carries one dead letter setting. That was already so before this change: a topic has one tier set, however many listeners read it. When a topic is read both by a listener of its own and by a group, the tiers take the topic's own listener's setting, which is what Topics[source] gave before.
Reading one topic through two listeners on the same node, with different dead letter settings, is a configuration I'd rather leave to the maintainers: either refuse it at startup, or carry the originating listener's policy through the retry headers. Neither is needed to get a group's failures retried at all, so I've kept this PR to that.
| var listened = Topics | ||
| .Where(t => t.IsListener && t.RetryTierDelay == null) | ||
| .Select(t => t.TopicName) | ||
| .Concat(TopicGroups.Where(g => g.IsListener).SelectMany(g => g.TopicNames)) |
There was a problem hiding this comment.
This isn't specific to groups. A tier topic is a separate KafkaTopic endpoint, and nothing copies the source listener's StickyHandlers to it. So ListenToKafkaTopic("orders").AddStickyHandler(...) with MoveToKafkaRetryTopic(...) already resolves no handler on orders.retry.<delay> when every chain for the message type is sticky. That is true on main today, before this PR.
Before this PR a group's failure was never retried at all. A group now behaves exactly as a single topic does. Binding the source's sticky handlers to its tiers would fix both cases. It is a separate change, and I'd suggest a follow-up issue for it rather than widening this one.


MoveToKafkaRetryTopic(...)registered retry-tier listeners only for the topics inKafkaTransport.Topics, and aListenToKafkaTopics(...)group lives inTopicGroups, so its topics got no tiers. The continuation still applied to the group's listener: it produced the failure to<topic>.retry.<delay>and committed the source offset, and on a cluster that auto-creates topics nothing read the record again.Change
RetryTierSourceTopicstakes the topics of every listeningKafkaTopicGroupas sources too. A topic listened to alone and in a group gets its tiers once.TryFind, not theTopicsindexer, which would register an endpoint for each topic of the group.Tests (
kafka_retry_topics_for_topic_groups_6127.cs)RetryTierSourceTopics: a group's topics are sources, and a topic in both a group and a listener of its own is listed once.kafka_retry_topics:kafka_retry_topics,kafka_retry_topics_on_a_named_broker_6064,multi_topic_listeningand the Kafka: JsonOnlyMapper overwrites the record key on copies, and topics named *.retry.* get no retry tiers #5772 tier tests (14 of 14).Fixes #6127
🤖 Generated with Claude Code