I have a service which makes between 1 and 10 HTTP calls at once, depending on the input. I want to wait for all of the promises to finish before rendering a response.
After searching the docs, I rested upon using Streams publish, flatMap and toList to merge all of the promises together. Before I dove into writing the HttpClient code, I decided to write some test code to make sure the streams api was going to do the job.
It doesn't appear to work. For some reason, the list value I am getting back is empty. After inspecting the stream a little more, it appears that flatMap doesn't forward the promised value onto the next subscriber.
Before I raise a github issue, I wanted to make sure I'm not doing anything wrong, or check if a different method exists for merging promises.
I'm using ratpack v0.9.15, and here is my test code: