bobcorsaro commented on issue #190:
URL: 
https://github.com/apache/pulsar-client-python/issues/190#issuecomment-1904245833

   > > @codelipenghui no, see example code:
   > > > `consumer_name=f'testconsumer-{os.getpid()}'`
   > 
   > This is for the consumer name. Not the subscription name.
   > 
   > `max_total_receiver_queue_size_across_partitions` only works for the 
partitioned topic. The root cause is that the 
`max_total_receiver_queue_size_across_partitions` only controls the receiver 
queue size of the sub consumers instead of the parent 
consumer(MultiTopicConsumer). The default receiver queue size of the parent 
consumer is still 1000. As a workaround, you can adjust the 
`receiver_queue_size` for the consumer to match the 
`max_total_receiver_queue_size_across_partitions`.
   > 
   > Here is an example for your case:
   > 
   > ```python
   >     sub = client.subscribe(
   >         topic=TOPIC,
   >         subscription_name=SUBSCRIPTION,
   >         consumer_type=ConsumerType.Shared,
   >         max_total_receiver_queue_size_across_partitions=1,
   >         consumer_name=f'testconsumer-{os.getpid()}',
   >         receiver_queue_size=1
   >     )
   > ```
   > 
   > This behavior is same with the Java client.
   > 
   > For further improvements:
   > 
   > * There is a lack of testing for the 
`max_total_receiver_queue_size_across_partitions`. We need to enrich the test 
cases.
   > * `max_total_receiver_queue_size_across_partitions` only works for the 
multiple topics consumer. It's better to print a warn log when the users use 
the multiple topics consumer with 
`max_total_receiver_queue_size_across_partitions`.
   > * When setting the `max_total_receiver_queue_size_across_partitions`, the 
user also needs to consider the `receiver_queue_size` for the consumer. It's 
not user-friendly.  We may need to find a way to improve it.
   
   I've adjusted the test code by adding `receiver_queue_size=` and reproduced 
the same issue. Creating a backlog of 100 messages on a 4 partitioned topic, 
type Shared, only the first consumer gets a single message. After it 
disconnects, the second consumer gets a message. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to