Eclipse Vert.x 3.7.1

We have just released Vert.x 3.7.1, a bug fix release of Vert.x 3.7.x and a few small features.

Since the release of Vert.x 3.7.0, quite a few bugs have been reported. We would like to thank you all for reporting these issues.

In addition of bug fixes, this release prepares the ground for Vert.x 4 with a few enhancements and deprecations.

HTTP client Unix Domain Sockets

Since this release the HttpClient supports Unix Domain Sockets when using Netty’s native transports, which can be really useful if you need to connect to a local daemon such as Docker’s Daemon:

HttpClient httpClient = vertx.createHttpClient();
 
// Only available on BSD and Linux with native transport
SocketAddress addr = SocketAddress.domainSocketAddress("/var/tmp/myservice.sock");
 
// Send request to the server
httpClient.request(HttpMethod.GET, addr, 8080, "localhost", "/", resp -> {
  // Process response
}).end();

HTTP client WebSocket connect revisited

The HttpClient WebSocket methods have been revisited, indeed these methods were lacking of usability in general or with vertx-rx due to the optional error handling:

HttpClient client = vertx.createHttpClient();
client.websocket(80, "example.com", "/", websocket -> {
  // connected
});
 
// or
 
client.websocket(80, "example.com", "/", websocket -> {
  // connected
}, err -> {
  // handle error
});
 

The new webSocket method provides now the best developer experience for connecting a WebSocket:

HttpClient client = vertx.createHttpClient();
client.webSocket(80, "example.com", "/", ar -> {
  if (ar.succeeded()) {
    // connected
  } else {
    // handler error
  }
});

With RxJava2, you can use now:

HttpClient client = vertx.createHttpClient();
Single<WebSocket> single = client.rxWebSocket(80, "example.com", "/");
single.subscribe(
  ws -> {
    // connected
  },
  err -> {
    // handle error
  });

Vert.x Rx usability improvements

As you may know, the Vert.x Rxified API is generated from the bare Vert.x API.

In this release, vertx-codegen has been improved to determine if an API object is an Iterable, Iterator, or Function. Then its Rxified equivalent will be an Iterable, Iterator, or Function too.

Let’s take an example. The Vert.x MultiMap class represents a multi-map of String keys to a list of String values. It’s useful to represent things like HTTP headers and parameters which allow multiple values for keys.

Since the bare io.vertx.core.MultiMap implements Iterable<Map.Entry<String, String>>, you can iterate through the content with a for-each loop. Starting with 3.7.1, the same is possible with the Rxified version:

io.vertx.reactivex.core.MultiMap headers = request.headers();
for (Entry<String, String> header : headers) {
  // inspect header  
}

Or, for advanced transformations:

Flowable<Entry<String, String>> headers = Flowable.fromIterable(request.headers());

GraphiQL IDE

Vert.x 3.7.0 added support for building GraphQL servers with Vert.x Web and GraphQL-Java.

In 3.7.1, the GraphQL handler can be configured to expose the GraphiQL IDE:

GraphQLHandlerOptions options = new GraphQLHandlerOptions()
  .setGraphiQLOptions(new GraphiQLOptions()
    .setEnabled(true)
  );
 
router.route("/graphql").handler(GraphQLHandler.create(graphQL, options));

Vert.x 3.8.0 is the next release

The next version of Vert.x will be 3.8 and targets end of June / early July with the following themes:

  • Introducing a Promise interface to be used instead of Future in a couple of places of the codebase such as Verticle start or executeBlocking. The goal is to move the completion part in Vert.x 4 from Future to Promise which becomes the object to be completed and Future is a view that is consumed by clients
  • Json Pointer support
  • The new SQL client will be released as tech preview (until v4)
  • RedisPool as tech preview (until v4) bring back connection management, lazy reconnect and scaling to all client modes (Single, Sentinel and Cluster)

Vert.x 3.7.1 release notes

Vert.x 3.7.1 deprecations and breaking changes

https://github.com/vert-x3/wiki/wiki/3.7.1-Deprecations-and-breaking-changes

The event bus client using the SockJS bridge are available from NPM, Bower and as a WebJar:

Docker images are also available on the Docker Hub. The Vert.x distribution is also available from SDKMan and HomeBrew.

The artifacts have been deployed to Maven Central and you can get the distribution on Bintray.

Happy coding and see you soon on our user or dev channels.

Posted on 27 May 2019
in releases
3 min read

Related posts