-
Notifications
You must be signed in to change notification settings - Fork 8
Interview about Reakt Reactive Java Programming Part 1
This is a short interview with Rick Hightower about Reakt - Java Reactive Programming lib for Promises and Streams.
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.
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.
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.
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.
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.
Reakt does streaming as well and we do have a need for such a set of bridges. It seems likely.
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.
We added invokable promises and
safeThen
andsafeThenExpect
... 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.
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 thecatchError
. 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.
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.
Coming soon
Java Promises
- Promise
- Promise then*() and catchError()
- Promise thenMap()
- Promise all()
- Promise any()
- Blocking Promise
- Invokable Promise
- Reactor Replay Promises
Reactor, Stream, Results
- QBit Reactive Microservices
- Reakt Reactive Java
- Reakt Guava Bridge
- QBit Extensions
- Elekt Consul Leadership election
- Elekt Leadership election
- Reactive Microservices
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.
Reactive Programming, Java Microservices, Rick Hightower
Java Microservices Architecture
[Microservice Service Discovery with Consul] (http://www.mammatustech.com/Microservice-Service-Discovery-with-Consul)
Microservices Service Discovery Tutorial with Consul
[Reactive Microservices] (http://www.mammatustech.com/reactive-microservices)
[High Speed Microservices] (http://www.mammatustech.com/high-speed-microservices)
Reactive Microservices Tutorial, using the Reactor
QBit is mentioned in the Restlet blog
All code is written using JetBrains Idea - the best IDE ever!
Kafka training, Kafka consulting, Cassandra training, Cassandra consulting, Spark training, Spark consulting
Java Promises
- Promise
- Promise then*() and catchError()
- Promise thenMap()
- Promise all()
- Promise any()
- Blocking Promise
- Invokable Promise
- Reactor Replay Promises
Callback, and async Results
Reactor, Stream and Stream Result
Expected & Circuit Breaker
Scala Akka and Reakt