-
Notifications
You must be signed in to change notification settings - Fork 289
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
Add async split_partition_queue to StreamConsumer #351
Conversation
Upon further research, it seems like for this to work there would need to be a type of |
…ducing ArcMessage type
I've committed on a second approach, which is more flexible regarding the lifetime of the Async Partition Queue. I've added a new type |
Now the only remaining problem is much of the |
5907f46
to
afff390
Compare
Ok, this api now has a design that I think works best. What I've opted to do is to add a
|
One final change: I've opted to remove the boxing of |
c4f6cd0
to
e931027
Compare
Thanks very much for working on this, @nemosupremo! I'm sorry I haven't had a chance to look things over yet. Things are busy at work right now, and this partition queue stuff is really subtle. Definitely a useful change though. Hopefully have time for a proper review soon. |
Sorry for the very long delay here. I put together a slightly different implementation in #411, but one that was very much based on this one! The big difference is a refactor that allowed the removal of the |
Thanks again for the PR! |
I currently need a way to consume partitions concurrently in an asynchronous context.
BaseConsumer
currently providessplit_partition_queue
for "synchronous" polling, butStreamConsumer
provides no function. I decided to take a stab at implementing it, as it seemed simple enough; however this PR is more in the design stage.What I opted to do was "overload"
MessageStream
to simply rollover an enum of values, either aStreamConsumer
orArc<BaseConsumer>
+Partition
. To achieve this I also hadStreamConsumer
always hold on to anArc
of BaseConsumer, which I think should have a very minimal cost compared to the owned version.The only problem I see is that each
PartitionQueue
has its lifetime tied to theStreamConsumer
despite eachPartitionQueue
holding an Arc to base consumer. I'm not sure yet if this is an onerous restriction, however an alternate design would require a newMessageStream
type (which I think may duplicate more code), or allowingMessageStream
to hold an Arc toStreamConsumer
or making the implantation ofMessageStream
generic over the "consumer".