Chapter 3. Features
3.1. New and Changed features
This section describes the new functionalities introduced in this release. It also contains information about changes in the existing functionalities.
3.1.1. Context server interceptor binds all types of data and is more secure
From Eclipse Vert.x 4.0.3, the ContextServerInterceptor.bind() method binds all types of data to the context. The method is more secure now as it does not expose the storage details.
In releases prior to Eclipse Vert.x 4.0.3, the method used to bind only 'String' data type to context. It also exposed the storage details.
To use the updated ContextServerInterceptor.bind() method, you must update your application.
The following example shows the code in releases prior to Eclipse Vert.x 4.0.3.
// Example code from previous releases
class X extends ContextServerInterceptor {
@Override
public void bind(Metadata metadata, ConcurrentMap<String, String> context) {The following example shows the replacing code fpr Eclipse Vert.x 4.0.3 release.
// Replacing code for Eclipse Vert.x 4.0.3 release
class X extends ContextServerInterceptor {
@Override
public void bind(Metadata metadata) {3.1.2. Matching of ending slash (/) in route paths that end with wildcard character is no longer required
In releases prior to Eclipse Vert.x 4.0.3, if routes were defined with a path ending in slash and a wildcard /*, the routes would be called only if the matching request also included the ending slash /. This rule caused problems when the wildcard was empty.
From Eclipse Vert.x 4.0.3 onward, this rule is no longer applied. You can create routes whose paths end in a slash (/). However, it is not mandatory to specify the slash in the request URLs.
Also, you can create and use request URLs to call routes that end with wildcards in their path instead of slash (/). For example, routes with wildcard can be defined as /foo/*. Here the route has to match an open wildcard at the end of the path. The request URL can be /foo.
The table shows the behavior in Eclipse Vert.x 4.0.3 and previous releases when you send a request URL /foo/*. You can see that the ending slash is optional in Eclipse Vert.x 4.0.3 and request matches the route.
| Route | Eclipse Vert.x 4.0.3 | Releases prior to Eclipse Vert.x 4.0.3 |
|---|---|---|
|
| Match | No Match |
|
| No Match | No Match |
|
| Match | Match |
|
| Match | Match |
3.1.3. Removed the autoRegistrationOfImporters attribute from service discovery options
The autoRegistrationOfImporters attribute has been removed from service discovery options.
3.1.4. Authenticate method in authentication provider class updated to support token as input credentials
In releases prior to Eclipse Vert.x 4.0.3, the AuthenticationProvider.authenticate() method would incorrectly take jwt: someValue as input credentials.
From Eclipse Vert.x 4.0.3, the AuthenticationProvider.authenticate() method has been updated and takes token: someValue as input credentials. This change ensures that both JSON and typed APIs are consistent and can be used interchangeably.
The following code shows the implementation for the authenticate method in releases prior to Eclipse Vert.x 4.0.3.
new JsonObject().put("jwt", "token...");The following code shows the implementation for the authenticate method in Eclipse Vert.x 4.0.3 release.
new JsonObject().put("token", "token...");3.1.5. Get method for PEM keys returns Buffer instead of a String
The PubSecKeyOptions.getBuffer() method returns the PEM or secret key buffer. In releases prior to Eclipse Vert.x 4.0.2, the key buffer was stored and returned as a String. However, it is recommended to save secrets as a Buffer. From Eclipse Vert.x 4.0.2 onward, the method stores and returns the key buffer as a Buffer. This change improves the security and handling of secrets.
The PubSecKeyOptions.setBuffer() method continues to accept a String argument. In the set method, an overload for Buffer has been added to safely handle non ASCII secret materials. This change does not require any change to the existing code.
3.1.6. Kubernetes service importer is no longer registered automatically
From Eclipse Vert.x 4, the KubernetesServiceImporter discovery bridge is no longer registered automatically. Even if you have added the bridge in the classpath of your Maven project, it will not be automatically registered.
You must manually register the bridge after creating the ServiceDiscovery instance.
3.1.7. Use future methods for asynchronous operations
Eclipse Vert.x 4 uses futures for asynchronous operations. Every callback method has a corresponding future method.
Futures can be used to compose asynchronous operations. When you use futures, the error handling is better. Therefore, it is recommended to use a combination of callback and futures in your applications.
3.1.8. No dependency on the Jackson Databind library
In Eclipse Vert.x 4, Jackson Databind is an optional Maven dependency. If you want to use this dependency, you must explicitly add it in the classpath. For example, if you are object mapping JSON, then you must explicitly add the dependency.
3.1.9. Handling deprecations and removals
In Eclipse Vert.x 4, new enhanced features have been provided. The old features and functions have been deprecated or removed in Eclipse Vert.x 4. Before you migrate your applications to Eclipse Vert.x 4, check for deprecations and removals.
The Java compiler generates warnings when deprecated APIs are used. You can use the compiler to check for deprecated methods while migrating applications to Eclipse Vert.x 4.
3.1.10. Support for distributed tracing
Eclipse Vert.x 4 supports distributed tracing. You can use tracing to monitor microservices and identify performance issues.
Eclipse Vert.x 4 integrates with OpenTracing system.
The following Eclipse Vert.x components can log traces:
- HTTP server and HTTP client
- Eclipse Vert.x SQL client
- Eclipse Vert.x Kafka client
Tracing is available as Technology Preview. Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.
3.1.11. New publishing location for EventBus JavaScript Client
In Eclipse Vert.x 4, the EventBus JavaScript client, vertx-web-client.js is not published as a Red Hat artifact in the Maven repository.
The client is published in the npm repository. You can access the client from the following location: @vertx/eventbus-bridge-client.js
3.1.12. Deploy Eclipse Vert.x applications using OpenShift Maven plugin
Use the OpenShift Maven plugin to deploy your Eclipse Vert.x applications on OpenShift. The Fabric8 Maven plugin is no longer supported. For more information, see the section migrating from Fabric8 Maven Plugin to Eclipse JKube.
3.1.13. Eclipse Vert.x metering labels for OpenShift
You can add metering labels to your Eclipse Vert.x pods and check Red Hat subscription details with the OpenShift Metering Operator.
Do not add metering labels to any pods that an operator deploys and manages.
Eclipse Vert.x should use the following metering labels:
-
com.redhat.component-name: Vert.x -
com.redhat.component-type: application -
com.redhat.component-version: 4.0.3 -
com.redhat.product-name: "Red_Hat_Runtimes" -
com.redhat.product-version: 2021-Q1
See Metering documentation for more information.
For more information on labels, see Understanding how to update labels on nodes.
3.1.14. Support for OpenJDK 8 and OpenJDK 11 RHEL 8 Universal Base Images (UBI8)
Eclipse Vert.x introduces support for building and deploying Eclipse Vert.x applications to OpenShift with OCI-compliant Universal Base Images for Red Hat OpenJDK 8 and Red Hat OpenJDK 11 on RHEL 8.
The RHEL 8 OpenJDK Universal Base Images replace the RHEL 8 OpenJDK builder images. The RHEL 8 OpenJDK base images are no longer supported for use with Eclipse Vert.x.
3.2. Deprecated features
This section lists the functionalities deprecated or removed in this release.
HttpServerOptionsRemoved methods Replacing methods getMaxWebsocketFrameSize()getMaxWebSocketFrameSize()setMaxWebsocketFrameSize()setMaxWebSocketFrameSize()getMaxWebsocketMessageSize()getMaxWebSocketMessageSize()setMaxWebsocketMessageSize()setMaxWebSocketMessageSize()getPerFrameWebsocketCompressionSupported()getPerFrameWebSocketCompressionSupported()setPerFrameWebsocketCompressionSupported()setPerFrameWebSocketCompressionSupported()getPerMessageWebsocketCompressionSupported()getPerMessageWebSocketCompressionSupported()setPerMessageWebsocketCompressionSupported()setPerMessageWebSocketCompressionSupported()getWebsocketAllowServerNoContext()getWebSocketAllowServerNoContext()setWebsocketAllowServerNoContext()setWebSocketAllowServerNoContext()getWebsocketCompressionLevel()getWebSocketCompressionLevel()setWebsocketCompressionLevel()setWebSocketCompressionLevel()getWebsocketPreferredClientNoContext()getWebSocketPreferredClientNoContext()setWebsocketPreferredClientNoContext()setWebSocketPreferredClientNoContext()getWebsocketSubProtocols()getWebSocketSubProtocols()setWebsocketSubProtocols()setWebSocketSubProtocols()Eclipse Vert.x Web
Removed elements Replacing elements io.vertx.ext.web.Cookieio.vertx.core.http.Cookieio.vertx.ext.web.handler.CookieHandlerio.vertx.core.http.Cookieio.vertx.ext.web.Localeio.vertx.ext.web.LanguageHeaderRoutingContext.acceptableLocales()RoutingContext.acceptableLanguages()StaticHandler.create(String, ClassLoader)---
SessionHandler.setAuthProvider(AuthProvider)SessionHandler.addAuthProvider()HandlebarsTemplateEngine.getHandlebars()HandlebarsTemplateEngine.getResolvers()HandlebarsTemplateEngine.setResolvers()JadeTemplateEngine.getJadeConfiguration()ThymeleafTemplateEngine.getThymeleafTemplateEngine()ThymeleafTemplateEngine.setMode()TemplateEngine.unwrap()Messaging
Removed methods Replacing methods MessageProducer<T>.send(T)MessageProducer<T>.write(T)MessageProducer.send(T,Handler)EventBus.request(String,Object,Handler)EventBus
Removed methods Replacing methods EventBus.send(…, Handler<AsyncResult<Message<T>>>)Message.reply(…, Handler<AsyncResult<Message<T>>>)replyAndRequestHandlers
Removed methods Replacing methods Future<T>.setHandler()Future<T>.onComplete()Future<T>.onSuccess()Future<T>.onFailure()HttpClientRequest.connectionHandler()HttpClient.connectionHandler()JSON
Removed Fields/Methods New methods Json.mapper()fieldDatabindCodec.mapper()Json.prettyMapper()fieldDatabindCodec.prettyMapper()Json.decodeValue(Buffer, TypeReference<T>)JacksonCodec.decodeValue(Buffer, TypeReference)Json.decodeValue(String, TypeReference<T>)JacksonCodec.decodeValue(String, TypeReference)JUnit5
Deprecated methods New methods VertxTestContext.succeeding()VertxTestContext.succeedingThenComplete()VertxTestContext.failing()VertxTestContext.failingThenComplete()Reactive Extensions (Rx)
Deprecated methods New methods WriteStreamSubscriber.onComplete()WriteStreamSubscriber.onWriteStreamEnd()WriteStreamSubscriber.onWriteStreamError()Circuit breaker
Removed methods Replacing methods CircuitBreaker.executeCommand()CircuitBreaker.execute()CircuitBreaker.executeCommandWithFallback()CircuitBreaker.executeWithFallback()MQTT
Removed methods Replacing methods MqttWill.willMessage()MqttWill.getWillMessage()MqttWill.willTopic()MqttWill.getWillTopic()MqttWill.willQos()MqttWill.getWillQos()MqttAuth.username()MqttAuth.getUsername()MqttAuth.password()MqttAuth.getPassword()MqttClientOptions.setKeepAliveTimeSeconds()MqttClientOptions.setKeepAliveInterval()AMQP client
Removed methods Replacing methods AmqpClient.createReceiver(String address, Handler<AmqpMessage> messageHandler, …)AmqpClient createReceiver(String address, Handler<AsyncResult<AmqpReceiver>> completionHandler)AmqpConnection createReceiver(…, Handler<AsyncResult<AmqpReceiver>> completionHandler)AmqpConnection createReceiver(String address, Handler<AsyncResult<AmqpReceiver>> completionHandler)AmqpConnection createReceiver(.., Handler<AmqpMessage> messageHandler, Handler<AsyncResult<AmqpReceiver>> completionHandler)AmqpConnection createReceiver(String address, Handler<AsyncResult<AmqpReceiver>> completionHandler)Authentication and authorization
Removed elements Replacing elements OAuth2Options.isUseBasicAuthorizationHeader()No replacing method
OAuth2Options.setUseBasicAuthorizationHeader()No replacing method
OAuth2Options.getClientSecretParameterName()No replacing method
OAuth2Options.setClientSecretParameterName()No replacing method
OAuth2Auth.createKeycloak()KeycloakAuth.create(vertx, JsonObject) ()OAuth2Auth.create(Vertx, OAuth2FlowType, OAuth2ClientOptions)()OAuth2Auth.create(vertx, new OAuth2ClientOptions().setFlow(YOUR_DESIRED_FLOW))OAuth2Auth.create(Vertx, OAuth2FlowType)OAuth2Auth.create(vertx, new OAuth2ClientOptions().setFlow(YOUR_DESIRED_FLOW))User.isAuthorised()User.isAuthorized()AccessToken.refreshToken()AccessToken.opaqueRefreshToken()io.vertx.ext.auth.jwt.JWTOptionsdata objectio.vertx.ext.jwt.JWTOptionsdata objectSecretOptionsclassPubSecKeyOptionsclassDeprecated methods Replacing methods OAuth2Auth.decodeToken()AuthProvider.authenticate()OAuth2Auth.introspectToken()AuthProvider.authenticate()OAuth2Auth.getFlowType()No replacing method
OAuth2Auth.loadJWK()OAuth2Auth.jwkSet()Oauth2ClientOptions.isUseAuthorizationHeader()No replacing method
Deprecated class Replacing class AbstractUserCreate user objects using the ` User.create(JsonObject)` method.
AuthOptionsNo replacing class
JDBCAuthOptionsJDBCAuthenticationOptionsfor authentication andJDBCAuthorizationOptionsfor authorizationJDBCHashStrategyNo replacing class
OAuth2RBACAuthorizationProviderOauth2ResponseRecommended to use
WebClientclassKeycloakHelperNo replacing class
Service discovery
Removed methods Replacing methods ServiceDiscovery.create(…, Handler<ServiceDiscovery> completionHandler)ServiceDiscovery.create(Vertx)ServiceDiscovery.create(…, Handler<ServiceDiscovery> completionHandler)ServiceDiscovery.create(Vertx, ServiceDiscoveryOptions)Eclipse Vert.x configuration
Removed methods Replacing methods ConfigRetriever.getConfigAsFuture()retriever.getConfig()MongoDB client
Removed methods Replacing methods MongoClient.update()MongoClient.updateCollection()MongoClient.updateWithOptions()MongoClient.updateCollectionWithOptions()MongoClient.replace()MongoClient.replaceDocuments()MongoClient.replaceWithOptions()MongoClient.replaceDocumentsWithOptions()MongoClient.remove()MongoClient.removeDocuments()MongoClient.removeWithOptions()MongoClient.removeDocumentsWithOptions()MongoClient.removeOne()MongoClient.removeDocument()MongoClient.removeOneWithOptionsMongoClient.removeDocumentsWithOptions()Clients with no shared data sources
Deprecated Methods New Methods MongoClient.createNonShared()MongoClient.create()JDBCClient.createNonShared()wJDBCClient.create()CassandraClient.createNonShared()CassandraClient.create()MailClient.createNonShared()MailClient.create()Hook methods
Removed Methods New Methods Context.addCloseHook()No replacing method
Context.removeCloseHook()No replacing method
Clone methods
Removed Methods New Methods KeyCertOptions.clone()KeyCertOptions.copy()TrustOptions.clone()TrustOptions.copy()SSLEngineOptions.clone()SSLEngineOptions.copy()VertxOptionsRemoved Methods New Methods VertxOptions.equals()No replacing method
VertxOptions.hashCode()No replacing method
VertxOptions.fileResolverCachingEnabled()FileSystemOptions.isFileCachingEnabled()Pooled buffer
Removed Methods New Methods TCPSSLOptions.isUsePooledBuffers()No replacing method
TCPSSLOptions.setUsePooledBuffers()No replacing method