How to get a hazelcast instance in plugin?

Hello everyone, I am running my server on Openfire 3.10.0 with Hazelcast plugin 1.3.3

I am trying to develop a plugin that supports clustered environment, on the official documentation I see that you can use distributed map to share data between nodes:

http://docs.hazelcast.org/docs/3.3/manual/html-single/hazelcast-documentation.ht ml#map

I wonder how would I be able to get a hazelcast instance under my openfire plugin? (HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance():wink:

Is there any official plugin that supports hazelcast that I can get some hints? Or maybe any experienced dev that can answer my question?

Thank you in advance.

There should be no need to access the Hazelcast instance directly from your plugin. If you would like to use a custom distributed cache within your plugin, you can simply create it via the CacheFactory.createCache(String cacheName) method.

The default HZ cache configuration will work fine for most cases, but if you would like to further customize the cluster configuration for your cache you can update the hazelcast-cache-config.xml file accordingly. Just deploy your custom configuration in the Hazelcast plugin /classes/ directory and restart each cluster member.

If you would like to know more about the many available Hazelcast cache configuration options, I would refer you to the HZ documentation for more information.

Tom thank you for the fast reply, I was worrying about not getting a reply for at least days but thank god thatโ€™s not the case.

I am not aware of the CacheFactory and what it does at the moment, could you recommend some factory plugins that utilize this function so I can study the codes?

Thank you again.