Using RxJava with Dropwizard is no different than using it with any other framework that uses Jersey.
In this demo app, a slow and a fast backend service is simulated and combined into a single response.
This is done asynchronously using Jersey's AsyncResponse
and RxJava's subscribeOn()
.
Java 8 JDK should be installed and java
on your $PATH
.
To build, run:
$ ./gradlew oneJar
To run:
$ java -jar build/libs/rxdemo-1.0-SNAPSHOT-standalone.jar server src/dist/config/demo.yml
Check out the examples in DemoResource.java for the different ways to do async and how they differ from each other.