Closed magnet closed 7 years ago
That looks like a good idea. Insteaf of callback, I would recomment using vert.x future.
It would be extremely practical to be able to add to the result instead of only creating a "finished / successful" result, for instance to stream CSV files, although it might prove harder to integrate to the current design.
e.g:
callback.put(resultPart);
(later)
callback.put(resultPart);
This is a slightly more complex model, but it makes streaming results that are computed "by-line" possible.
Today, actions, even those returning an AsyncResult, are blocking by nature.
It should be possible to write code such as:
In the controller:
or :
In the service:
Currently, with Wisdom's ExecutorService we can setup the number of threads to get X running tasks in parallel, but we're stuck if for instance we have thousands of async non-blocking tasks that take a few minutes each...
The ideal solution should provide a way to stream results, by defining a StreamResult type that we can add elements to until we "finish" (that's probably another topic, but it only makes sense in non-blocking results).