Community contributed extensions

Documentation for the Hazelcast module

This module is a dropin replacement for EhCacheImpl or MemcachedImpl from Play.
It allow your application to have a clustered cache when you can’t install a memcached server on your platform.
It’s also a great free open source In-Memory Data Grid

See Hazelcast Documentation for more details.

Installing Hazelcast Module

To install Hazelcast Plugin module, you do like every other Play Modules:

play install hazelcast[-version]

Using Hazelcast Module in your application (Dependency management)

There is two way to use the module

module.hazelcast=${play.path}/modules/hazelcast-[version]
require:
	- play -> hazelcast [version]

Using standard Play! Framework Cache Mechanisms

All the standard Play annotations or methods work seamlessly with Hazelcast instead of EhCache or Memcached.

See Play Framework Cache Documentation for CacheFor("1h") and provided Play! Cache.xxx() usage.

Using features from Hazelcast

Using @Inject to inject an instance of Hazelcast in your controller

@Inject private static HazelcastInstance hazel;

Injecting the default ExecutorService

@Inject private static ExecutorService executor;

Using @Named to inject a named resource

@Named("MyQueue") private static Queue myQueue;

Hazelcast clustered services

Configuration file hazelcast.xml

You can modify hazelcast.xml to your need to create more Queues or Map and modify the default ExecutorService parameters. Just copy the hazelcast.xml file from the module conf directory to your application conf directory. This is also the file that allow you to change from multicast to TCPIP static cluster definition.

Hazelcast Object type that can be retreived via @@Named@ annotation

Hazelcast Object type that can by retreived via @@Inject@ annotation

Method directly accessible on HazelcastPlugin class

1 Use this to get a Transaction object then you can begin() or commit() or rollback() operations on cluster.

2 Use this to lock an object across the cluster.

3 Use this if you absolutly NEED to directly get the Default Hazelcast instance.

Roadmap

I’d like to see some basic Play! features use Hazel capabilities: