Skip to content

Conversation

@moonyoungCHAE
Copy link
Contributor

Previously, the documentation only described manual topic partition assignment for @KafkaListener. I added information on how to configure it using by topics and topicPartitions. Thanks.

resolve: #4189

@moonyoungCHAE moonyoungCHAE force-pushed the issue-4189 branch 2 times, most recently from 3d62b5f to b942c4b Compare December 9, 2025 05:36
Signed-off-by: moonyoungCHAE <xpf_fl@naver.com>
== Topic Partition Assignment

You can also configure POJO listeners with explicit topics and partitions (and, optionally, their initial offsets).
You can configure the topic for `@KafkaListener` in three ways. You must configure the topic in one of these ways.
Copy link
Contributor

Choose a reason for hiding this comment

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

Only one sentence per line.

----


You can simply configure the topic directly by name. In this case, you can also configure the multiple topics like `topics = {"myTopic1", myTopic2"}`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Only one sentence per line.


You can also configure topics using topicPattern, which enables topic subscription based on a regular expression.

When you configure topics using either of these ways (topic or topic pattern), Kafka automatically assigns partitions according to the consumer group. Alternatively, you can configure POJO listeners with explicit topics and partitions (and, optionally, their initial offsets).
Copy link
Contributor

Choose a reason for hiding this comment

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

Only one sentence per line.

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.

Add TopicPattern docs for @KafkaListener

2 participants