BewareMyPower commented on issue #424:
URL: 
https://github.com/apache/pulsar-client-cpp/issues/424#issuecomment-2096044238

   - If the `MessageId` comes from non-batched messages, the implementation is 
[`MessageIdImpl`](https://github.com/apache/pulsar-client-cpp/blob/main/lib/MessageIdImpl.h)
 that does not have the `acker`. When it's acknowledged, a `CommandAck` will be 
sent.
   - If the `MessageId` comes from batched messages, the implementation is 
[`BatchedMessageIdImpl`](https://github.com/apache/pulsar-client-cpp/blob/main/lib/BatchedMessageIdImpl.h)
 that has an `acker` field, which is a shared pointer of `BatchMessageAcker` 
that maintains a bit set.
   
   For example, a batched message whose size is 2 have two message IDs.
   
   ```yaml
   id1:
     ledger: 100
     entry: 0
     partition: -1
     batch_index: 0
     batch_size: 2
     acker: 0b11
   
   id2:
     ledger: 100
     entry: 0
     partition: -1
     batch_index: 1
     batch_size: 2
     acker: 0b11
   ```
   
   `0b11` represents the bit set that has 2 bits where each bit is set.
   
   1. After acknowledging `id1`, the bit set becomes 0b10. Nothing will happen.
   2. After acknowledging `id2`, the bit set becomes 0b00. Since it's empty 
now, a `CommandAck` will be sent to the broker that indicates the entry of 
ledger 100 and entry 0 should be acknowledged.
   
   I'm not very sure about how did you store the message ID in a raw array. But 
if your message ID array could contain default-constructed `MessageId` objects, 
whose implementation is `MessageIdImpl`, see 
https://github.com/apache/pulsar-client-cpp/blob/3f0b33bfad746fd2da63fe062ea745d9a9caed55/lib/MessageId.cc#L35
   


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