BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Vert.x 3.3.0 Features Enhanced Networking Microservices, Testing and More

Vert.x 3.3.0 Features Enhanced Networking Microservices, Testing and More

Vert.x has released version 3.3.0 of their toolkit for building reactive, distributed and polyglot applications on the top of the Java Virtual Machine.

The release provides a large number of new features and improvements, the most important of which we will cover here.

Networking

Vert.x 3.3.0 provides built-in support for HTTP2, allowing developers to create HTTP2 clients and servers including H2C and HTTP2 push.

HTTP/2 is a framed protocol using frames for the HTTP request and response. This release allows applications to receive custom frames using the customFrameHandler on the request; this will get called every time a custom frame arrives. The documentation provides an example:

request.customFrameHandler(frame -> {
  System.out.println("Received a frame type=" + frame.type() +
      " payload" + frame.payload().toString());
});

Support for Socks5 and HTTP proxies is also new, allowing you to configure proxy settings when configuring TCP and HTTP clients.

In Java DNS name resolution is a blocking transaction, and using a slow DNS server may block the Vert.x event loop for a significant amount of time, contrary to the Vert.x mantra: “Never block the event loop”. To avoid this, Vert.x 3.3.0 integrates an async DNS resolver. When you create a HTTP client or a TCP client, the host names are now resolved asynchronously. It is also used during the initialization of TCP and HTTP servers.

The Vert.x event bus is the spine of Vert.x applications. It allows the different parts of a Vert.x application to communicate via messages. It was not previously possible to configure the TCP aspect of this communication, but in 3.3.0, you can configure all aspects of this communication, including SSL, and so you can secure exchanges over the event bus.

Integration

Vert.x applications are generally integrated into a broader system, and Vert.x 3.3.0 improves how Vert.x and the rest of the system interact. First, it provides a bridge with Apache Camel, the popular integration framework that provides more than 100 components to connect with a wide range of applications.

Vert.x 3.3.0 provides a RabbitMQ client, and an AMQP 1.0 client and bridge. AMQP 1.0 is a popular cross platform messaging protocol used in a wide spect of use cases.

As security is a core concern of any Internet application, Vert.x 3.3.0 adds support for the OAuth 2 authentication mechanism, so now you can easily connect your applications with any OAuth 2 providers such as Google, LinkedIn, Github, KeyCloak, Twitter or Facebook.

Microservices

Vert.x has been a pioneer of microservice architecture since inception, but the practices around microservices have evolved, and with Vert.x 3.3.0, we provide:

  • Service discovery
  • Circuit breaker

Service discovery is a way to improve the location transparency of your services; instead of hardcoding locations, services are discovered at runtime. The service discovery is extensible to support environments using Consul or Kubernetes.

Vert.x always considered failures as a first-class citizen, but sometimes you need more sophisticated failure management, especially to avoid pushing too hard on a (failing) service. For this use case, Vert.x provides its own implementation of the circuit breaker pattern.

Monitoring

Vert.x 3.3.0 also extends the set of collected metrics. This provides support for HTTP2 of course, but it also enables better thread monitoring, managed by Vert.x. For example, it’s now possible to monitor the worker queue and so configure its size to meet your needs.

JDBC connection pools also provide enhanced feedback metrics for improved tuning.

Programming with Vert.x

Vert.x 3.3.0 also improves the development model with improved composition of Futures for concurrent task execution and easier chaining of asynchronous operations.

Application testing is essential and Vert.x Unit has been improved to allow the use of any assertion framework. You are no longer limited to the assertion provided by the TestContext; you can use Hamcrest, AssertJ or Rest-Assured.

These are just some of the features and improvements. Much more is available as part of Vert.x 3.3.0, including JDBC batch support, Redis geo instructions, etc. You can find more information on the Vertx.io website.

Rate this Article

Adoption
Style

BT