...
The goal of investigation was to find a way to chain async operations avoiding the so-called "pyramid of doom" or "callback hell" caused by nesting the callbacks that results in poor code readability. Even the most innocent . In the most innocent version of two nested callbacks the code can look something like the following:
...
The approach is basically the same - decomposition on separate methods in order to improve code readability of the code. The sample module can be found on github - mod-sample-rx.
...
Conclusion
Both approaches allow to decompose the code and make it more readable. However, using rx-java would require significant changes in raml-module-builder. Therefore, using of composed futures might be the "go-to" solution while rx-java might be further investigated in case of discovering some additional benefits of using it.