Integration with Hazelcast (Extension Module)

Tamaya Hazelcast is an extension module. Refer to the extensions documentation for further details.

What functionality this module provides ?

Tamaya Hazelcast provides a property source which uses Hazelcast as configuration backend. Hereby the module supports read-only integration (as a HazelcastPropertySource as well as a writing configuration changes back (based on Tamaya’s MutableConfiguration API defined by the tamaya-mutable-config extension module.


The module is based on Java 8.


To use tamaya-hazelcast you only must add the corresponding dependency to your module:


The Extensions Provided

Hazelcast integration comes basically with 2 artifacts:

  • The org.apache.tamaya.hazelcast.HazelcastPropertySource is a PropertySource. The property source is not automatically registered. Either register it using the ServiceLoader yourself or implement and register a corresponding PropertySourceProvider.

  • If the tamaya-mutable-config module is loaded it is possible to write property values back into the consul cluster, by accessing a MutableConfiguration using the URI config:hazelcast.

Access of consul key/value pairs is through the normal Tamaya API.

The HazelcastPropertySource

The HazelcastPropertySource is not automatically registered and provides different options how to integrate Tamaya with Hazelcast. It provides:

  • a Hazelcast based property source implementation.

  • configurable caching of key/values.

  • configuraing a dedicated Hazelcast map ID to be used.

To use hazelcast as a configuration backend, you simply create the corresponding Hazelcast instance and use it to initialize the Tamaya property source. Given that a hazelcast backend configuration can be easily created as illustrated below:

Config hazelcastConfig = new Config();
// define config settings
HazelcastInstance hazelcastInstance = Hazelcast.newInstance(hazelcastConfig);
HazelcastPropertySource ps = new HazelcastPropertySource(hazelcastInstance);
// Build your own configuration context
ConfigurationBuilder b = Configuration.createConfigurationBuilder();
// Add the hazelcast property source (as most significant)
// build and use the configuration
Configuration config = b.build();

The AbstractHazelcastPropertySource

The AbstractHazelcastPropertySource is the baseclass used by HazelcastPropertySource. Use it to implement your own Hazelcast based property source.