Interview about Reakt Reactive Java Programming Part 1
Interview with Rick Hightower about Java Reactive programming and Reakt
This is a short interview with Rick Hightower about Reakt - Java Reactive Programming lib for Promises and Streams.
Why did you create Reakt?
Good question. Many of the ideas in Reakt were already in QBit. The problem is that QBit is a full microservices lib with health, monitoring, a typed actor system, service discovery, etc. QBit’s focus in on reactive microservices with Java.
Why not just use the QBit Reactive Microservices Lib?
We sometimes are on projects that do not use QBit (RxJava, Vert.x, Java EE), and we have to deal with async calls. Other times we want to write another lib but don't want to bring over all of QBit when we need just promises and a Reactor. We found that we were re-implementing features that exist in QBit, and had many one-offs. We wanted a consistent way to deal with callbacks and streams.
What are the differences between QBit Reactive Microservices Lib and Reakt Reactive Java lib?
Many ideas in Reakt are in QBit, but in Reakt there are better names and a more fluent model, mainly, because it is our second attempt. This has to do with a lot of experience working with async APIs like Vert.x, reactive streams, RxJava and Spark and some experience working in the Node.js realm. Even if you don't use QBit microservices, you might want Promises and Streams that are Java 8/9 friendly with lambada and a fluent API. Reakt is about Reactive Java that is Java 8 lambda function friendly and fluent. QBit 1.5 is using more and more of Reakt and the differences are diminishing. Where there is overlap, expect QBit to move towards Reakt.
Where is Reakt used?
There is a bridge included with QBit 1.x. We are starting to use it with all of our QBit Microservices projects. We created a bridge so you can use it with Guava and Vert.x, which means you can use it with the Cassandra API which uses Guava. We plan on writing more bridges. Also a Promise is a Callback and a Callback is a Java 8 Consumer with an error Consumer. If you are using Reakt, it does not have to bubble through your architecture. You can turn promises into Consumers. Reakt is a small lib for Reactive Java, it is not a framework or a new programming language. We try to be agenda free as possible.
What influenced the design or Reakt?
We wrote some libs in Node.js to talk to QBit over the Vert.x event bus / Socket JS and we really liked, and we really liked the JS promises. We have similar things in QBit pre 1.0, but like the JS terminology. JS promises are a lot like Scala promises. Then the idea hit us, let's create a common Stream/Promises lib that we can use on every project even if we are not using QBit, and let’s make it better than the one QBit Microservices lib ships with (which we planned to improve for QBit 2.x anyway). ... Let's make the lib easy to use, and interface based so others can use it too and have their own implementations. We hope we can convince other async projects to standardize (de facto) on this interface lib, and work with us on it. In the mean time, we will write bridges. We have a bridge for Reakt Guava and Reakt Vertx.
Will there be a bridge for RxJava and Reactive Streams
Reakt does streaming as well and we do have a need for such a set of bridges. It seems likely.
What is the future of Reakt / QBit?
QBit 2.0 will use Reakt direct instead of implementing its own Callback/reactive interface. QBit 1.5 has started to use Reakt quite a bit.
I have used Reakt 2.0 What is new in Reakt?
We added invokable promises and
safeThenExpect... Going back to your first question one of reasons we wrote Reakt is because we plan on forking Vert.x to provide an IO only lib called Conekt so we can write clients libs like Elekt and Service Discovery. Conekt will implement Reakt IO, which is in progress. And, we wanted to use the same Callback/Stream mechanism that we had in QBit with Conekt, Reactive IO, but needed to break that out at the same time.
Ok.. slow down what is an Invokable promise?
An Invokable Promise is a way to do fluid async Reactive programming in Java! Instead of registering a callback, the async service returns an invokable promise. It really makes the code more readable, and delineates the call arguments (in) versus registering the
thenhandler and the
catchError. It is brings a new level of fluent programming to async Reactive Java programming. QBit remote and local client proxies support the proxy returning an invokable promise.
Why do you have a blockable promise in an async library?
Mostly for unit testing and legacy integration. Let’s you want to use an async client in a traditional application. We try to make it easy. It also makes unit testing a lot easier, which has been an bane of async development. We have used some of the async unit testing frameworks and they leave a lot to be desired. Also if you are just prototyping, it helps to use a blocking promise.
We have not talked about Reakt Streams yet.