You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Samreay (via GitHub)" <gi...@apache.org> on 2023/12/21 02:03:52 UTC

[I] Negative acknowledge doesn't work with message_id [pulsar-client-python]

Samreay opened a new issue, #178:
URL: https://github.com/apache/pulsar-client-python/issues/178

   The docs state:
   
   ```python
       def negative_acknowledge(self, message):
           """
           Acknowledge the failure to process a single message.
   
           When a message is "negatively acked" it will be marked for redelivery after
           some fixed delay. The delay is configurable when constructing the consumer
           with {@link ConsumerConfiguration#setNegativeAckRedeliveryDelayMs}.
   
           This call is not blocking.
   
           Parameters
           ----------
   
           message:
               The received message or message id.
           """
   ```
   
   Specifically, that you can pass either the message or the message id into the function. However, I don't believe this is correct, and passing the message id does not work. To reproduce this issue, first run a local pulsar standalone instance, via
   
   ```bash
   docker run -it -p 6650:6650 -p 8080:8080 --tmpfs /pulsar/data apachepulsar/pulsar:3.1.0 bin/pulsar standalone
   ```
   
   And then run the following code:
   
   ```python
   import pulsar
   
   client = pulsar.Client("pulsar://localhost:6650")
   producer = client.create_producer("persistent://public/default/tmp_example")
   consumer = client.subscribe("persistent://public/default/tmp_example", "sub", negative_ack_redelivery_delay_ms=10)
   producer.send(b"hello")
   while True:
       msg = consumer.receive()
       message_id = msg.message_id()
       print(msg, message_id)
       # consumer.negative_acknowledge(msg) # This works and causes redelivery
       consumer.negative_acknowledge(msg.message_id())  # This does not cause redelivery
   ```
   
   When you pass in the message_id, no redeliveries occur. When you comment out the last line and swap to passing in the message as a whole, redeliveries occur.
   
   **Why using the message id matters:** Our services consume the pulsar messages and convert them into non-pulsar structures (like pydantic objects or other python classes). We attach the message id to those objects so we can ack/nack them as needed without storing the entire original pulsar 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: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative acknowledge doesn't work with message_id [pulsar-client-python]

Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on issue #178:
URL: https://github.com/apache/pulsar-client-python/issues/178#issuecomment-1868930429

   Oh, it's not the issue with type checking. It's a regression that was introduced by https://github.com/apache/pulsar-client-python/pull/121.
   
   <img width="1358" alt="image" src="https://github.com/apache/pulsar-client-python/assets/18204803/2cba14cb-5bbe-4172-809e-909fb116edd2">
   
   I will push a fix ASAP and include it in the incoming 3.4.0 release.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative acknowledge doesn't work with message_id [pulsar-client-python]

Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on issue #178:
URL: https://github.com/apache/pulsar-client-python/issues/178#issuecomment-1868860957

   Yeah it's a bug that `acknowledge` also has the same issue.
   
   https://github.com/apache/pulsar-client-python/blob/bf8524a858eae1eced14a283bbe7dffdee534742/pulsar/__init__.py#L1508
   
   We should check more types here.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Negative acknowledge doesn't work with message_id [pulsar-client-python]

Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower closed issue #178: Negative acknowledge doesn't work with message_id
URL: https://github.com/apache/pulsar-client-python/issues/178


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org