Loading

Kafka Connector | Topic Subscription Patterns vs Assignments in Consumer Configuration

Дата публикации: Mar 23, 2025
Решение

QUESTION

What's the difference between Topic Subscription Patterns and Assignments in Apache Kafka Consumer Configuration of Kafka Connector for Mule 4?

ANSWER

Both Topic Subscription Patterns and Assignments are used to configure the topics and partitions that the consumer would subscribe to. But they are mutually exclusive, i.e. only one of them should be configured.

User-added image

For Topic Subscription Patterns, you can configure a list of subscription regular expressions to which to subscribe. Topics are automatically rebalanced between the topic consumers.

Assignments can be used when you want to explicitly subscribe to particular partitions of topics rather than letting Kafka automatically assign partitions to consumers. You can configure a list of topic-partition pairs to assign. Consumers are not automatically rebalanced.

If multiple consumers subscribe to the same topic-partition pair using Assignments, all of them will consume the messages from the same partition, while using Topic Subscription Patterns the consumers won't consume from the same partition of a topic.

If there is only one partition in a topic but two consumers subscribe to it using Topic Subscription Patterns, only one of them will consume messages from the partition. In case the working consumer goes down, the other one will start to consume messages from the partition.
Номер статьи базы знаний

001120382

 
Загрузка
Salesforce Help | Article