yakir-Yang opened a new issue #12059:
URL: https://github.com/apache/pulsar/issues/12059


   Case 1. After receiving the message from Pulsar consumer, just calling the 
consumer.acknowledge() immediately, this message can be acknowledged 
successfully. Here's the code
   ```
   consumer.receiveAsync().thenAccept(msg -> {
       consumer.acknowledge(msg.getMessageId());
       ....
   }
   ```
   
   Case 2. If I calling the toByteArray & fromByteArrayWithTopic functions, the 
message just can't be acknowledged successfully.
   ```
   consumer.receiveAsync().thenAccept(msg -> {
       MessageId msgId = 
MessageId.fromByteArrayWithTopic(msg.getMessageId().toByteArray(), 
topic.toString());
       consumer.acknowledgeAsync(msgId);
       ....
   }
   ```
   
   Case 3. If I calling the toByteArray & fromByteArray functions, the message 
just still can't be acknowledged successfully.
   ```
   consumer.receiveAsync().thenAccept(msg -> {
       MessageId msgId = 
MessageId.fromByteArray(msg.getMessageId().toByteArray());
      consumer.acknowledgeAsync(msgId);
       ....
   }
   ```
   
   Case 4. Still failed
   ```
   ```
   consumer.receiveAsync().thenAccept(msg -> {
       String messageId = 
Base64.getEncoder().encodeToString(msg.getMessageId().toByteArray());
       MessageId msgId = 
MessageId.fromByteArrayWithTopic(Base64.getDecoder().decode(messageId), 
topic.toString());
       consumer.acknowledgeAsync(msgId);
       ....
   }
   ```


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