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 a 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.

Using Vert.x Hazelcast Cluster Manager

See the Vert.x Hazelcast Cluster Manager site for reference documentation for the vertx-hazelcast module.

You can also follow our Get started with Vert.x guide.

Using a different Hazelcast version

Due to Java compatibility reasons the Vert.x Hazelcast module doesn’t depend on the latest version of Hazelcast. You can change the Hazelcast dependency to any version of Hazelcast you need, e.g. you can change it to Hazelcast 5.2.x for Java 8 compatibilty, or to the latest.

The old versions may not be supported by Hazelcast anymore and don’t 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>