Integrate with Vert.x
Vert.x is a reactive application toolkit for creating resource-efficient, concurrent, asynchronous and flexible applications on the JVM.
Hazelcast integrates with Vert.x in the form of a cluster manager — the Hazelcast Cluster Manager.
In Vert.x, a cluster manager is used for various functions including:
-
Discovery and group membership of Vert.x nodes in a cluster.
-
Maintaining cluster-wide topic subscriber lists (so we know which nodes are interested in which event bus addresses).
-
Distributed Map support.
-
Distributed Locks.
-
Distributed Counters.
The io.vertx:vertx-hazelcast
module is part of Vert.x and is maintained by the Vert.x team with contributions from Hazelcast. This module is licensed under the Apache 2 license.
To enable clustering, start your Vert.x application with the -cluster
parameter.
Configuration
Provide a file named cluster.xml
on your classpath to configure a Hazelcast instance used by Vert.x.
For other configuration methods see the Vert.x documentation.
Versioning and Hazelcast compatibility
The Vert.x Hazelcast module follows the versioning of Vertx. If you use an x.y.z
version of Vert.x, you should use an x.y.z
version of vertx-hazelcast
.
While older versions may work, such configurations are not supported.
Use Vert.x Hazelcast Cluster Manager
For reference documentation for the vertx-hazelcast
module, see the Vert.x Hazelcast Cluster Manager site.
You can also follow our Get started with Vert.x guide.
Use a different Hazelcast version
Due to Java compatibility reasons, the Vert.x Hazelcast module does not depend on the latest version of Hazelcast. You can change the Hazelcast dependency to any version of Hazelcast you need.
Older versions may not be supported by Hazelcast or receive any patches. |
There are multiple ways to replace the transitive dependency. The most reliable way is to exclude the com.hazelcast:hazelcast
transitive dependency of the vertx-hazelcast
module and add a direct dependency on com.hazelcast:hazelcast
to the pom.xml of your project.
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
<exclusions>
<exclusion>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>5.5.0</version>
</dependency>