Announcing Quarkus Hazelcast Client Integration

Today, we’re happy to announce the preview version of quarkus-hazelcast-client is publicly available and accessible via quarkus-platform and code.quarkus.io.

Quarkus is a modern Kubernetes-native application framework leveraging Docker and GraalVM which allows it to achieve impressive performance and resource utilization while maintaining portability.

Quarkus Hazelcast Client extension makes it convenient to configure Hazelcast Client and leverage GraalVM support.

The full documentation can be found here.

 

Configuration

Using code.quarkus.io

If you want to configure a base project, it’s easy enough to go to code.quarkus.io, search for the extension, and choose it:

And then generate the project:

 

Manually

Since the extension is a part of the quarkus-universe-bom, in order to get it working it’s enough to provide just a single entry:

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>quarkus-hazelcast-client</artifactId>
</dependency>

Injecting the Client

Once the extension is added, the Hazelcast Client bean becomes immediately available as HazelcastInstance:

@Inject
HazelcastInstance hazelcastClient;

Client Configuration

Hazelcast Client default settings can be customized by providing the following entries in the application.properties file:

quarkus.hazelcast-client.cluster-name
quarkus.hazelcast-client.cluster-members
quarkus.hazelcast-client.outbound-port-definitions
quarkus.hazelcast-client.outbound-ports
quarkus.hazelcast-client.labels
quarkus.hazelcast-client.connection-timeout

Naturally, you can rely on standard hazelcast-client.xml/yml config files should you need access to the full configuration.

GraalVM Support

One of Quarkus’ main advantages is that we can generate GraalVM native images of our applications easily.

To benefit from GraalVM, an extra configuration is required but this is where Quarkus Hazelcast Client extension shines and provides automatic configuration and GraalVM substitutions.

Even if one decides to wire their own HazelcastClient instance, the classpath presence of Quarkus Hazelcast Client enables convenient GraalVM support.

Keep in mind that GraalVM doesn’t work with native Java serialization so you need to stick to other serialization mechanisms supported by Hazelcast IMDG.

Testing Support

The extension comes with a sidecar quarkus-test-hazelcast extension that allows convenient management of the Hazelcast IMDG lifecycle in tests:

@QuarkusTest
@QuarkusTestResource(HazelcastServerTestResource.class)
public class HazelcastAwareTest {
    @Test
    public void test() {
        // ...
    }
}

All you need to do is to add a dedicated dependency:

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>quarkus-test-hazelcast</artifactId>
</dependency>

Closing Remarks

If you want to receive release updates, remember to watch the official repository here.

If you want to give it a try, check out the example projects in these guides:

  1. Quarkus Hazelcast Client with Kubernetes
  2. Quarkus Hazelcast Client