Summary

In this chapter, we covered a few ways to create the Observables to connect with regular Java code.

We learned that Observable.fromCallable() and Observable.fromFuture() are very useful in most of the simple cases. Observable.fromCallable() is used more with custom code, while Observable.fromFuture() is more fitting for the integration with external libraries that already use Futures.

Additionally, we saw how we can use the Emitter interface to construct more advanced and complex flows with custom clean up (.setCancellable()) code.

We learned how to use a few simple methods in the TwitterStream library to connect to the Twitter and start receiving updates.

Subsequently, we used the Emitter interface to plug in the existing Twitter4J interface of TwitterStream into the Observable, which allowed us to easily integrate tweets into the flow of the existing financial stock updates.

Finally, we adapted the existing UI to show tweets and financial stock updates at the same time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.47.166