BewareMyPower commented on issue #114:
URL: 
https://github.com/apache/pulsar-client-python/issues/114#issuecomment-1550995838

   The cumulative acknowledgment cannot be used for Key_Shared subscription. I 
think we need to enhance the error processing at the Python client side. We 
should return an error instead of crash.
   
   ----
   
   BTW, I cannot reproduce this issue with the following code with Python 
client 3.1.0 and Pulsar standalone 2.11.0.
   
   ```python
   from pulsar import Client, ConsumerType, InitialPosition
   
   pulsar_client = Client('pulsar://localhost:6650')
   topic = 'my-topic'
   
   producer = pulsar_client.create_producer(topic=topic)
   producer.send('msg-0'.encode())
   producer.send('msg-1'.encode())
   producer.close()
   
   consumer = pulsar_client.subscribe(
       topic=topic,
       subscription_name='sub',
       initial_position=InitialPosition.Earliest,
       consumer_type=ConsumerType.KeyShared,
   )
   
   msg = consumer.receive()
   print(f'{msg.data()} | {msg.message_id()}')
   msg = consumer.receive()
   print(f'{msg.data()} | {msg.message_id()}')
   
   consumer.acknowledge_cumulative(msg)
   
   pulsar_client.close()
   ```
   
   Output:
   
   ```
   b'msg-0' | (5,0,-1,-1)
   b'msg-1' | (5,1,-1,-1)
   ```
   
   The cumulative acknowledgment just fail without any exception thrown.


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