-
Notifications
You must be signed in to change notification settings - Fork 46
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
36 fix streams drain control #37
Conversation
core/src/test/scala/com/softwaremill/kmq/redelivery/IntegrationTest.scala
Outdated
Show resolved
Hide resolved
core/src/test/scala/com/softwaremill/kmq/redelivery/IntegrationTest.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/com/softwaremill/kmq/redelivery/streams/RedeliveryTrackerStream.scala
Outdated
Show resolved
Hide resolved
6d766fd
to
7a0c34d
Compare
7a0c34d
to
e4ffc31
Compare
RunnableGraph | ||
.fromGraph(GraphDSL.createGraph(redeliverySink, commitMarkerSink)(combineFutures) { | ||
val cancellable = RunnableGraph | ||
.fromGraph(GraphDSL.createGraph(redeliverySink, commitMarkerSink)(Keep.left) { |
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.
don't we need to cancel both sinks?
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.
What's special in the RedeliverySink is an additional TickSource that is instantiated there. Without the TickSource both sinks appear to be closed correctly and the DrainingControl is able to shut down the stream.
Here I'm exposing a hook to the TickSource as Cancellable materialized view from the whole RedeliverySink.
.toMat(Sink.ignore)(DrainingControl.apply) | ||
.run() | ||
} | ||
} | ||
|
||
class AggregatingToMatFlow[T] extends GraphStageWithMaterializedValue[FlowShape[T, T], Iterable[T]] { |
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.
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 hope it's interesting in a positive way :)
It's certainly not the simplest in general. But here we have additional TickSource merged inside one of the nested sinks which doesn't stop when it's source stops.
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, in a positive way :)
I think the problem of stopping sub-streams is not that uncommon, as it emerges also when using the .groupBy
which I mentioned. So either it's already solved in some way, or we have a solution which would be a great material for a short blog post :)
Closes #36