Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds multi-topic support to
AioKafkaBrokerwhile keeping the existing single-topic behavior fully backward compatible.Why
Some projects need different task groups to use different Kafka topics, while still running through the same taskiq broker and worker setup. For example, regular tasks, email tasks, reports, or priority-specific workloads may need separate Kafka topics for routing, isolation, monitoring, or operational control.
Previously,
AioKafkaBrokeralways sent every task to one broker-level Kafka topic. This change allows each task to define its own default topic, and also allows overriding the topic for a singlekiqcall.What Changed
TopicConfigandTopichelper structures.AioKafkaBrokerwith multi-topic support:kafka_topicremains the default topic.kafka_topicscan be used to configure additional topics for the worker to listen to.@broker.task(topic="...")sets a default Kafka topic for that task.task.kicker().with_topic("...").kiq(...)overrides the topic for a single task kick.delete_topic_on_shutdown=True.AioKafkaBrokerusage.