shibd opened a new pull request, #228: URL: https://github.com/apache/pulsar-client-cpp/pull/228
### Motivation Currently, the batch receive method may cause data loss. The root cause is, when `message` can't add to `messages`(The batch has satisfied the batch receive policy), it has actually been popped. https://github.com/apache/pulsar-client-cpp/blob/ba7f59d2bb28b72fa6d1d01abada71090537b45e/lib/ConsumerImpl.cc#L652-L657 ### Modifications - Peek first, pop only when it can be added. ### Verifying this change - Change `testBatchReceive` test to cover this case: Send 100 messages first, batch receive 10 messages at a time, and assert that all messages can be received. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc-required` (Your PR needs to update docs and you will update later) - [x] `doc-not-needed` (Please explain why) - [ ] `doc` (Your PR contains doc changes) - [ ] `doc-complete` (Docs have been already added) -- 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]
