GitHub user lhotari added a comment to the discussion: Whats the right sizing 
of producers & consumers on a partitioned topic with all subscription types ?

> Similarly, when we create a Pulsar Consumer , want to understand if it 
> subscribes to all partitions or not, w.r.t 4 subscription modes.

When using Shared or Key_Shared, each consumer instance will subscribe to all 
partitions of a partitioned topic.

The only other usable option is Failover consumer where one consumer will be 
active for a single partition at a time. There's a solution for balancing the 
consumers of individual partitions across the instances so that a single 
instance doesn't consume all partitions when there are multiple instances 
available. I found the documentation in the javadoc of 
[ConsumerBuilder.priorityLevel](https://pulsar.apache.org/api/client/3.2.x/org/apache/pulsar/client/api/ConsumerBuilder.html#priorityLevel(int)).
ConsumerBuilder.priorityLevel applies also to Shared subscription type, but it 
has a different purpose, it's for assigning the actual priorities or weights.

I guess it's rare to have a use case for exclusive consumers for 
multi-partitioned topics although it would work technically. 
The use case for an exclusive consumer is for active-passive configurations and 
usually there needs to be partition level control so that all partitions are 
handled on a single instance instead of splitting consumers across multiple 
instances. Perhaps there are good usecases also for exclusive multi-partitioned 
consumers. Someone else could elaborate on this.

GitHub link: 
https://github.com/apache/pulsar/discussions/22437#discussioncomment-9017684

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to