-
Notifications
You must be signed in to change notification settings - Fork 41
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
#374 - allow concurrent consumption of events #29
base: master
Are you sure you want to change the base?
#374 - allow concurrent consumption of events #29
Conversation
1cfa4da
to
dafe0de
Compare
7466597
to
c316ad9
Compare
Hey @m110 sorry for the direct ping, but I wonder if you could, as member of the org, review the PR or ask somebody who could do it. |
644709c
to
f528a17
Compare
f528a17
to
5c1acf0
Compare
@aldinugroho24 @yangyangrusli @m110 are you the maintainers of this repo? If yes, would you mind having a look at this PR? I think it would be a nice improvement. Also I wonder if you could use any help maintaining this repo. I see there's a bunch of piled PRs and I'm affected by some of those bugs, so I'd be happy to help if it works. |
I'm sorry about the long wait @nachogiljaldo, I'm on it now. Thanks for contributing! |
Closes ThreeDotsLabs/watermill#374
Why?
It would be nice to have a simple way to increase the concurrency of message processing. With the current options, it is only possible to consume one message at the time (i.e. you need to get > process > ACK > get > process > ...).
That is not actually required in many use cases where events with the same key are sent to the same partition and, therefore, a partial order exists within the partition.
What?
This PR:
batchedMessageHandler
works by collecting batches of messages up to a certain time or duration. Those messages are then sent to the output channel. NACKed messages are managed by resending every message following the NACKed one in that topic / partitionpartitionConcurrentMessageHandler
works by multiplexing each claim into the output channel, that allows having up to N messages in-flight, where N is the number of topics/partitions in the subscriber. NACKs / ACKs are handled by each multiplexedIMPORTANT: I tried to preserve the current default behavior. Therefore, there is a
Default
consumption model which behaves the same way it does now.Potential follow-up
A potential follow-up would be a consumer that allows for up to N messages being in-flight. That would allow for cases in which the developers want to maximize parallelism at the expense of complexity on their code.