Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between vert.x and RxJava

Tags:

rx-java

vert.x

We are evaluating reactive programming frameworks for one of our projects. I just went through vert.x tutorials. I checked RxJava presentation a bit. RxJava seemed more close to CompletableFuture. But despite the underlying patterns, both RxJava and Vert.x give access to non blocking programming. I am confused as to what is the difference between them. I will appreciate any help in this regard.

like image 513
user3276247 Avatar asked May 24 '17 07:05

user3276247


People also ask

What is RxJava used for?

RxJava is a Java library that enables Functional Reactive Programming in Android development. It raises the level of abstraction around threading in order to simplify the implementation of complex concurrent behavior.

What is the difference between Java and RxJava?

RxJava is a Java implementation of ReactiveX. The ReactiveX (or Reactive Extensions) project aims to provide a reactive programming concept. It's a combination of the Observer pattern, the Iterator pattern, and functional programming.

Is RxJava deprecated?

RxJava, once the hottest framework in Android development, is dying. It's dying quietly, without drawing much attention to itself. RxJava's former fans and advocates moved on to new shiny things, so there is no one left to say a proper eulogy over this, once very popular, framework.

What is ReactiveX RxJava?

RxJava is a Java VM implementation of Reactive Extensions: a library for composing asynchronous and event-based programs by using observable sequences.


2 Answers

VertX is a server framework for asynchronous servers while RxJava is a framework for asynchronous computations. VertX has support for RxJava and many use them together.

If you are going to create a web application and want a scalable backend, use VertX, possibly with RxJava. But if you are on another platform, just use RxJava.

Read more about using VertX and RxJava together at Vert.x API for RxJava

like image 103
Jonas Avatar answered Oct 18 '22 02:10

Jonas


From their own site:

Eclipse Vert.x is a toolkit for building reactive applications on the JVM.

It defines the fundamental APIs for writing asynchronous networked applications (eg: db connection, monitoring, authentication, service discovery, clustering, etc.)

Internally, it is based on the Netty project, a high-performance asynchronous networking library for the JVM. However, it provides a higher-level API easier to reason with and still highly performant.

You can use Vert.x callback-based API exclusively but Vert.x also implements an equivalent Rxified API using RxJava under the hood. This provides a great platform to integrate Vert.x modules within RxJava applications.

Vert.x is polyglot as it supports many other JVM based languages APIs such as Kotlin, Groovy, Ruby, Scala, and Ceylon. Moreover, since Vert.x is event-driven and message based, it also provides a JavaScript API quite useful to integrate frontend with backends.

Vert.x provides fluent HTTP endpoints and route configuration backed by handlers where the business logic is implemented. But the real nervous system is the event bus that acts as a telecom provider to all Vert.x local or distributed components.

This very event-bus supports:

  1. Point-to-point, request-response, and pub-sub messaging
  2. Communication between polyglot verticles within the same JVM instance
  3. Clustered communication between polyglot verticles in multiple JVM instances
  4. Bridge to Stomp or AMQP implementations for integration with other applications
  5. Bridge to SockJS for direct integration with Javascript frontends

The event-bus is supported by:

  1. Cluster managers such as Hazelcast, InfiniSpan, Ignite or ZooKeeper that provides distributed Maps, Locks, and Counters through a higher-level API access

  2. Vert.x service discovery API providing an address based abstraction to underlying complex addressing schemes

  3. SSL capable TCP service access points for bi-directional secured communication and maximum performance

Finally, Vert.x can be used by itself to develop a full-blown application or used collaboratively with frameworks such as SpringBoot, Fibers, etc.

More details here, here and here.

Hope this helps,

Softjake

like image 7
softjake Avatar answered Oct 18 '22 03:10

softjake