Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Introducing the Red Hat build of Eclipse Vert.x 4.0

January 21, 2021
Syed M Shaaf
Related topics:
ContainersJavaKubernetes
Related products:
Red Hat OpenShift

    If you are interested in reactive, non-blocking, and asynchronous Java development, you are likely familiar with Eclipse Vert.x. The project started in 2011 and successfully moved to the Eclipse Foundation in 2013. Since then, Vert.x has undergone nine years of rigorous development and grown into a thriving community. It is one of the most widely used reactive frameworks, with support for multiple extensions, including extensions for messaging or streaming with Kafka or Artemis, developing applications with gRPC and GraphQL, and so much more.

    The Red Hat build of Eclipse Vert.x 4.0 is now generally available. This release improves Vert.x's core APIs and handling. Developers who migrate can expect enhancements to futures and promises, distributed tracing, and deployment on Red Hat OpenShift. In this article, I introduce these updates and offer tips for migrating and deploying your Eclipse Vert.x 4.0 applications on OpenShift.

    Note: Please see the Red Hat build of Eclipse Vert.x 4.0 migration guide for a detailed introduction to migrating from Vert.x 3.x to Vert.x 4.0.

    The <Future> is here!

    Future is an AsyncResult<T> that you can use to create asynchronous operations in Vert.x 4.0. Every asynchronous method returns a Future object, success or failure, as the result of a call:

    FileSystem fs = vertx.fileSystem();
    
    Future<FileProps> future = fs.props("/my_file.txt");
    
    future.onComplete((AsyncResult<FileProps> ar) -> {
    
    if (ar.succeeded()) {
    
        FileProps props = ar.result();
    
        System.out.println("File size = " + props.size());
    
    } else {
    
        System.out.println("Failure: " + ar.cause().getMessage());
    
    }
    
    });
    

    If you prefer to use callbacks and get a Handler back, Vert.x 4.0 still implements props, as shown here:

    FileSystem props(String path,Handler<AsyncResult<FileProps>> handler)
    

    Developers migrating from Vert.x 3.x to Vert.x 4.0 can also use Future with callbacks:

    WebClient client = WebClient.create(vertx);
    
    HttpRequest request = client.get("/resource");
    
    Future<HttpResponse> response = request.send();
    
    response.onComplete(ar -> {
    
    if (ar.succeeded()) {
    
        HttpResponse response = ar.result();
    
    } else {
    
        Throwable failure = ar.cause();
    
    }
    
    });
    

    Error handling is more straightforward with futures than with callbacks. You don't need to track yourself back into each callback, and you can handle a failure just once, at the end of a composition. Futures also let you compose asynchronous events in parallel or sequentially. All in all, this feature greatly simplifies application programming with Vert.x.

    Promises

    A promise represents the writable side of an action that may or may not have yet occurred. Each promise has a future() method, which returns a Future for the given promise. You can use promises and futures together to get a notification of completion. The following example shows HttpServerVerticle using a promise.

    package com.example.starter;
    
    
    import io.vertx.core.AbstractVerticle;
    import io.vertx.core.Promise;
    
    public class MainVerticle extends AbstractVerticle {
    
    @Override
    
    public void start(Promise<Void> startPromise) throws Exception {
    
    vertx.createHttpServer().requestHandler(req -> {
    
    req.response()
    
      .putHeader("content-type", "text/plain")
    
      .end("Hello from Vert.x!");
    
      }).listen(8888, http -> {
    
        if (http.succeeded()) {
            startPromise.complete();
            System.out.println("HTTP server started on port 8888");
    
        } else {
            startPromise.fail(http.cause());
       }
    
    });
    
    }
    
    }
    

    In this case, the method returns the Future associated with a promise. We use the Future to send a notification when the promise has been completed and retrieve its value. Furthermore, a promise extends Handler<AsyncResult<T>> so that we can use it as a callback.

    Note: Before migrating your applications to Eclipse Vert.x 4.0, check for deprecations and removals. The compiler will generate a warning when you use a deprecated API.

    Distributed tracing

    Many components in a modern, distributed software application have their own operations lifecycle. The challenge is to trace various events and correlate that information across components. Tracing lets us understand the state of the system and how well the system adheres to key performance indicator metrics (KPIs). To find out how many people are getting help in a disaster-rescue effort, for example, we must correlate and trace data in a distributed software system. We can use that information to evaluate whether the software is meeting our business requirements.

    Distributed tracing lets us visualize and understand the chain of events and flows in an interaction between software applications. For distributed tracing in microservices environments, we can use Vert.x 4.0 with Jaeger, an OpenTracing client that is part of the Cloud Native Computing Foundation.

    Note: See the Red Hat OpenShift guide to configuring and deploying Jaeger for instructions to install Jaeger.

    Once we have Jaeger installed, we can use the following Vert.x components to log traces:

    • HTTP server and HTTP client
    • Eclipse Vert.x SQL client
    • Eclipse Vert.x Kafka client

    Each of these components implements the following TracingPolicy:

    • PROPAGATE: The component reports a span in the active trace.
    • ALWAYS: The component reports a span in the active trace or creates a new active trace.
    • IGNORE: Ignores tracing for the component in question.

    Here's an example of a simple tracing policy implementation:

    HttpServer server = vertx.createHttpServer(new HttpServerOptions()
    
    .setTracingPolicy(TracingPolicy.IGNORE)
    
    );
    

    See the Vert.x Opentracing examples repository for a more detailed tracing example with Vert.x and Jaeger.

    Metering labels for OpenShift

    You can now add metering labels to your Eclipse Vert.x applications running on OpenShift. Customers use the labels to track deployments they have subscribed to follow. Eclipse Vert.x uses the following metering labels:

    • com.redhat.component-name: Vert.x
    • com.redhat.component-type: application
    • com.redhat.component-version: 4.0.0
    • com.redhat.product-name: "Red_Hat_Runtimes"
    • com.redhat.product-version: 2021/Q1

    See the OpenShift 4.6 documentation for more about metering labels.

    Deploying Eclipse Vert.x applications to OpenShift

    Eclipse JKube is a collection of plug-ins and libraries for building container images using Docker, Jib, or source-to-image (S2I) build strategies. Unlike its predecessor, Fabric8, Eclipse JKube eases Java development on Kubernetes and OpenShift. Developers can focus on creating applications without getting into details, such as creating manifests.

    Eclipse JKube includes manifests as part of the Maven build, then generates and deploys them at compile time. The JKube plug-in generates resource manifests for you automatically, which you can apply afterward. Here's an example of how to run an application on OpenShift with Eclipse JKube:

    # The following commmands will create your OpenShift resource descriptors.
    
    mvn clean oc:resource -Popenshift
    
    
    # Starting the S2I build
    
    mvn package oc:build -Popenshift
     
    
    # Deploying to OpenShift
    
    mvn oc:deploy -Popenshift
    
    

    See this sample project using Eclipse JKube plug-ins for more details.

    Packaging and deployment

    You can now package and deploy your applications to OpenShift with Open Container Initiative (OCI)-compliant Universal Base Images for Red Hat OpenJDK 8 and 11 on Red Hat Enterprise Linux 8.

    Additionally, the Vert.x vertx-web-client.js is now published in the NPM repository and no longer available as a Maven artifact. You can access the client from @vertx/eventbus-bridge-client.js.

    New to reactive programming?

    If you are new to reactive programming, you can use self-paced scenarios to learn and experiment with Vert.x or learn about other technologies within Red Hat Runtimes. Each scenario provides a preconfigured Red Hat OpenShift instance that is accessible from your browser without any downloads or configuration.

    For developers who prefer to dive deep, I recommend reading Vert.x in Action by Julien Ponge.

    Get the Red Hat build of Vert.x 4.0

    Support for Eclipse Vert.x is available to Red Hat customers through a Red Hat Runtimes subscription. Red Hat's runtime support is scheduling according to the Red Hat product update and support lifecycle.

    If you are new to Eclipse Vert.x and would like to learn more, go to our live learning portal for a guided tutorial, or see the product documentation for technical details. You can also check the supported configurations and component details for Eclipse Vert.x on Red Hat Runtimes, and see the migration guide for a detailed introduction to migrating from Eclipse Vert.x 3.x to Vert.x 4.0.

    Last updated: June 30, 2023

    Recent Posts

    • Federated identity across the hybrid cloud using zero trust workload identity manager

    • Confidential virtual machine storage attack scenarios

    • Introducing virtualization platform autopilot

    • Integrate zero trust workload identity manager with Red Hat OpenShift GitOps

    • Best Practice Configuration and Tuning for Linux and Windows VMs

    What’s up next?

     

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.