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
Improvements to WritableBodyPublisher
#54
Comments
One more question regarding |
Hi @gpsfl, thanks for your suggestions! Passing a callback that's invoked only when content is needed sounds neat. Although mixing it with Regarding request failure, it can happen either before the HTTP client subscribes to the publisher or after. On the latter case, Otherwise, one can do:
to handle both cases. However, the callback option seems more neat. Regarding |
This sounds great! We have a similar method in our project right now which creates a WritableBodyPublisher and a new thread, however it already starts the thread before the BodyPublisher is subscribed. |
Right now users have to manually start a thread which writes into
WritableBodyPublisher
. This has two disadvantages:Instead I would suggest to pass a callback to
WritableBodyPublisher
which is invoked in a new thread after the http client subscribes to the body handler. This thread will also close the publisher and handle exceptions. Users may also pass a custom executor to launch the thread.Current version:
Suggestion:
The text was updated successfully, but these errors were encountered: