mantuliu opened a new issue #10750:
URL: https://github.com/apache/pulsar/issues/10750


   **Describe the bug**
   Key_shared mode is configured as ConsistentHashingStickyKeyConsumerSelector, 
When I use three consumers with the same consumerName, if one consumer is 
closed, the other two consumers will no longer be able to consume messages.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. config the 'conf/standalone.conf'
      ```
       subscriptionKeySharedUseConsistentHashing=true
      ```
   2. ./bin/pulsar standalone
   3. Start 3 consumers with the same cosumerName.
   ```
           PulsarClient client = PulsarClient.builder()
                   .serviceUrl("pulsar://localhost:6650")
                   .build();
   
           org.apache.pulsar.client.api.Consumer consumer = client.newConsumer()
                   .topic("my-topic")
                   .subscriptionName("my-subscription")
                   .consumerName("one")
                   .subscriptionType(SubscriptionType.Key_Shared)
                   .subscribe();
   ```
   4. Start a producer send messages.
   5. All 3 consumers can consume messages.
   6. Close one consumer, and the producer send messages again.
   7. **The other two consumers cannot consume new messages**
   
   **Expected behavior**
   The other two consumers can continue to consume new messages(Refer to step 7 
above).
   
   
   **Additional context**
   
https://github.com/apache/pulsar/blob/e19f6472183ac93dc058a96f7ac0537c22d90e18/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConsistentHashingStickyKeyConsumerSelector.java#L93
   
   I think the problem is due to the above code, which removes all consumers 
with the same name.


-- 
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.

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


Reply via email to