Java - Vert.X Framework

Java Conceptuel Diagram

Java - Vert.X Framework

About

Vert.x is not a framework but a toolkit: the core library defines the fundamental APIs for writing asynchronous networked applications, and then you can pick the useful modules for your application (e.g., database connection, monitoring, authentication, logging, service discovery, clustering support, etc).

Vert.x:

Usage

  • high volume message
  • event processing,
  • micro-services,
  • API gateways,
  • HTTP APIs for mobile applications,
  • etc

Concept

Three concepts:

  • Vertx - The core instance that allows:
    • high availability (HA) support. 1)
    • reference to the event bus,
    • setting timers,
    • calls the handlers using the event loop thread (Reactor pattern)
  • verticle - the actors deployed on Vertx
  • event bus - the bus that allows verticles to communicate

App

  • Verticle
package examples.vertx;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;

public class MyVerticle extends AbstractVerticle {

    @Override
    public void start(Future<Void> startFuture) {
        System.out.println("MyVerticle started!");
    }

    @Override
    public void stop(Future stopFuture) throws Exception {
        System.out.println("MyVerticle stopped!");
    }

}
  • Main
import io.vertx.core.Vertx;

public class VertxApp {

    public static void main(String[] args) {
        Vertx vertx = Vertx.vertx();
        vertx.deployVerticle(new MyVerticle());
    }

}





Discover More
Card Puncher Data Processing
What is an Event Loop?

An Event loop is a thread that waits for and dispatches events or messages that may contains: data or runnable code An event loop is also known as: message dispatcher, message loop, message...



Share this page:
Follow us:
Task Runner