Interview about Reakt Reactive Java Programming Part 1

Interview with Rick Hightower about QBit Microservices and Java Reactive programming with 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.

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.

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 so we create Reakt. Instead of re-implementing features that exist in QBit. Reakt gives us a consistent way to deal with callbacks and streams. Reakt is a small lib that focuses on reactive Java programming. 

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 is based on our experience working with async APIs like QBit, Vert.x, reactive streams, RxJava, Node.js and Spark. Even if you don't use QBit microservices, you can use Reakt. 

Reakt has 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 expression friendly and fluent. QBit 1.5 is using more and more of Reakt and the differences are diminishing (between QBit and Reakt's API). Where there is overlap, expect QBit to move towards Reakt. 

What influenced the design or Reakt Reactive Programming model?

We wrote some libs in Node.js to talk to QBit over the Vert.x event bus, and we really liked promises in Node.js/JavaScript. We have similar things in QBit pre 1.0 (CallbackBuilders are promises in QBit pre 1.0), but like the JS terminology. 

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. A QBit Callback is a Reakt Callback as of QBit 1.5, and QBit remote and local proxies already support invokable promises. 

I have used Reakt 2.0 What is new in Reakt?

We added invokable promises and safeThen 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 then handler 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. What...

To be continued. 

Reakt website

Related Projects

Further reading

What is Microservices Architecture?

QBit Java Micorservices lib tutorials

The Java microservice lib. QBit is a reactive programming lib for building microservices - JSON, HTTP, WebSocket, and REST. QBit uses reactive programming to build elastic REST, and WebSockets based cloud friendly, web services. SOA evolved for mobile and cloud. ServiceDiscovery, Health, reactive StatService, events, Java idiomatic reactive programming for Microservices.

Find more tutorial on QBit.

Reactive ProgrammingJava MicroservicesRick Hightower

High-speed microservices consulting firm and authors of QBit with lots of experience with Vertx - Mammatus Technology

Highly recommended consulting and training firm who specializes in microservices architecture and mobile development that are already very familiar with QBit and Vertx as well as iOS and Android - About Objects

Java Microservices Architecture

Microservice Service Discovery with Consul

Microservices Service Discovery Tutorial with Consul

Reactive Microservices

High Speed Microservices

Java Microservices Consulting

Microservices Training

Reactive Microservices Tutorial, using the Reactor

QBit is mentioned in the Restlet blog