-
Notifications
You must be signed in to change notification settings - Fork 645
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
Google PubSub: subscribe as a flow #2169
Conversation
So this new API is intended to allow you use it with a slower I agree the
I'm not sure I understand this scenario, could you give a more concrete example? |
In an example, I used The original idea was to have a flow to be able to restart I put the below example in source code. It is impossible to have
|
I think you could use a KillSwitch to achieve this, see https://doc.akka.io/docs/akka/current/stream/stream-dynamic.html#controlling-stream-completion-with-killswitch |
Yes, you can achieve a similar result. However, when you cancel the source it doesn't produce any demand. If you shut down the stream during the request, the request has to be handled and you have to drain the stream. This is how I see the difference, but I'm not familiar with the implementation of killswitch and I could be wrong. |
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 can see how this can be useful. Especially for composition with restart flow.
LGTM.
Thank you for suggesting this. Sorry for the delay. |
I have a small improvement for current PubSub API. Pulling from PubSub should be exposed as a flow, not the source. This gives the user more elasticity over stream composition.
The benefits are:
I left the old interface for backward compatibility.