fix #4154: adding a callback for stream consumption #5119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Here's a rough draft of the handling for places where outputstreams are passed in.
Instead the user may provide a simple StreamConsumer modeled after the handling that is done for the jdk WebSocket.Listener.onMessage method:
The next parameter is whether the handler is blocking or not - this merits some discussion.
We can do several things:
Any other non-blocking logic would be up to the user, but there is probably something we could build in for non-blocking writable byte channels.
In this scenario we could do some instanceof or other checks to try to automatically determine the appropriate mode as well.
The user could ultimately override though if needed.
Just assume everything is blocking, similar to what we're doing now with watches. If the eventual goal is to fully eliminate the kubernetes client thread pool, this won't get us there.
Or rely upon an existing reactive library for stream handling.
Beyond this the other cases we need to handle are:
@rohanKanojia @manusa @vietj what are your thoughts?
Type of change
test, version modification, documentation, etc.)
Checklist