-
Notifications
You must be signed in to change notification settings - Fork 77
[feat] Consumer support batch receive messages. #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR ci has can be passed. shibd#1 |
lib/ConsumerImplBase.cc
Outdated
| Lock lock(batchPendingReceiveMutex_); | ||
| notifyBatchPendingReceivedCallback(callback); | ||
| lock.unlock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Lock lock(batchPendingReceiveMutex_); | |
| notifyBatchPendingReceivedCallback(callback); | |
| lock.unlock(); | |
| notifyBatchPendingReceivedCallback(callback); |
IIUC, batchPendingReceiveMutex_ is used to make the accesses to batchPendingReceives_ thread safe. We don't need the lock here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. batchPendingReceiveMutex_ is only used to make the accesses to batchPendingReceives_ thread safe. I mixed it up.
Here need a lock to make hasEnoughMessagesForBatchReceive and notifyBatchPendingReceivedCallback is atomic, then prevents users receive not compliant with the policy messages.
I add a new batchReceiveOptionMutex_ lock to sync them.
But, This is not entirely guaranteed, Because I didn't synchronize the scenario where a single receive message is incomingQueue_ out of the queue.
In Java client impl, These operations are all performed in internalPinnedExecutor threads. So no problem.
I think it can be done this way first, and then I'll try to refactor it so that C++ also uses an internal thread to avoid adding various locks.
BewareMyPower
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found another problem.
### Motivation apache/pulsar#17140 This PR has been reviewed in [pulsar repo](apache/pulsar#17429). ### Modifications - Consumer support batch receives messages. - Abstract common implementation to `ConsumerImplBase`.
Motivation
apache/pulsar#17140
This PR has been reviewed in pulsar repo.
Modifications
ConsumerImplBase.Documentation
docMatching PR in forked repository
shibd#1