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
RxJava handling multiple Observable results #775
Conversation
Indeed this code could use some improvement. The response of course would not be rendered until all items are accumulated. Alternatively for a more streaming scenario where each item is rendered with a message converter, something similar to the ResponseBodyEmitterReturnValueHandler could be done. |
@rstoyanchev Interesting, so support |
That would be more idiomatic I think. Otherwise with an |
|
I can try to prepare a pull request later for that :) |
@jmnarloch that would be great! I think we should close this one in lieu of the new one. |
I've made the PR, it's look promising: #778 |
@jmnarloch, @spencergibb, after giving this full consideration for including in Spring Framework 4.3 we've reached a conclusion that hopefully will be helpful even if it doesn't go all the way. We've decided not to include built-in support in 4.3 and leave that to 5.0. We could have easily and cleanly added support for I did however make some changes that should make addressing your internal needs easier. See this pull request. You could register a I should clarify I didn't think it necessary to expose timeout customizations because Observable and Single have built-in timeout related capabilities that are probably sufficient. For example in your adapter code you can create DeferredResult and SseEmitter with some expanded timeout (say from 10 to 30 seconds) and combine that with the rx timeout operator to supply default values with some fluctuation per use case. For indicating SSE, it would be easy enough to return As to how to treat an Hope this helps. |
@rstoyanchev any reason you reopened this one instead of #778? |
No, no reason. I think this was linked from the PR somewhere. |
Thanks for your work! Will integrate the new changes with boot 1.4 and spring 4.3 and look forward to removing this with spring 5! |
No worries, this was overdue to consider with the 5.0 work progressing. |
PR that handles multiple values returned by the Observable.
I've seen lately remark that in order to use the current implementation you need to use Observable<List<T>>, which is quite counter intuitive since the Observable by itself can produce multiple results, so this PR tries to address this issue, by aggregating the results and postponing the actual moment when they are going to "applied" on the DeferredResult.
The only thing I was thinking of is whether arbitrary wrapping the values into a plain Object array is a good way to approach this.