Skip to content

4.4.5 Deprecations and breaking changes

Julien Viet edited this page Aug 30, 2023 · 5 revisions

Vertx Core

Deprecation of HttpServerResponse close method

https://github.com/eclipse-vertx/vert.x/pull/4807

The HttpServerResponse close method closes the HTTP connection, it can be misleading as there are better API to interact with the current request/connection lifecycle which are HttpServerResponse#reset and HttpConnection#close.

When the actual HTTP connection must be closed:

// Before
response.close();

// After
request.connection().close();

When the current request/response must be disposed:

// Before
response.close();

// After
response.reset();

Deprecation of Netty 4 API exposure in Vert.x API

https://github.com/eclipse-vertx/vert.x/pull/4793

The Vert.x API exposes the Netty API in its public API, allowing interactions with the Netty API. Since Netty is evolving toward Netty 5, we should remove Netty API from the Vert.x public API in Vert.x 5 to have the opportunity to change the underlying Netty version used by Vert.x without worrying about the version of the Netty version.

Such API continues to exist in Vert.x 5 but is moved to internal API which more easily change, therefore experimented users of this API can continue to use it granted that the version of Vert.x 5 uses Netty 4.

In practice most users should not use this API, and the deprecation should be seen also as a signal toward users of this API.

Deprecation of execute blocking methods with a handler of promise

https://github.com/eclipse-vertx/vert.x/pull/4783

The Vert.x API for executing blocking actions uses a pattern with handler completing or failing a promise, instead this can be replaced with java.util.concurrent.Callable that returns the same value or throws an exception.

// Before
Future<String> fut = vertx.executeBlocking(promise -> promise.complete("result"));

// After
Future<String> fut = vertx.executeBlocking(() -> "result");

This existing API is deprecated for removal in Vert.x 5.

There should be no ambiguity with existing lambda usage of such methods as new methods uses a callable that has no arguments.

Deprecate HTTP client host/port properties by an authority property

https://github.com/eclipse-vertx/vert.x/pull/4774

The HttpClientRequest/HttpServerRequest exposes the HTTP request authority using a host/port combination for the client request and a single host header for the server. In addition this terminology is also confusing with the server host and port.

Deprecate and provide the request host/port accessors, replaced by an authority property modelled as an @HostAndPort` object.

For client:

HttpClientRequest request = ...

// Before
request.setHost(host).setPort(port);

// After
request.authority(HostAndPort.create(host, port));

For server:

// Before
String host = request.host(); // host:port actually

// After
HostAndPort authority = request.authority();
Clone this wiki locally