The simplest way to integrate any Java code into RxJava is to use the Callable interface. It's an interface that represents an operation that returns some result and can throw an exception. It's very similar to Runnable; however, Runnable interface doesn't return any value.
To make Callable a part of reactive flow, the .fromCallable() method can be used on Observable:
Observable.fromCallable(() -> someOperation());
If the operation will be long-running, you must subscribe to an Observable on a specific scheduler:
Observable.fromCallable(() -> longRunningOperation()) ...