Cluster Callbacks

Sometimes there is a need to insert custom code that needs to happen before and after cluster operations. For example, you may want to send an email that notifies users when their clusters have been succesfully created and page your operations team if a cluster create operation failed. Or you may want to hook up created clusters to your existing monitoring system once they are created, and remove them from your monitoring system after they are deleted.

The Server can perform custom callbacks before the start of any cluster operation, after an operation has successfully completed, and after an operation has failed. To activate callbacks, you must set the server.callback.class setting in the server config to the fully qualified name of the class you want to use. The class must implement the ClusterCallback interface, and the jar containing the class must be included in the lib directory for the Server. The Server comes with a HttpPostRequestCallback class that can send a HTTP POST request containing the cluster, nodes, and job to a configurable URL at start, success, and failure of different types of cluster operations.

You can view the javadocs for more information about the interface and example callback class.