Kettle Lifecycle Plugin

The Kettle Lifecycle Plugin is provided as a way for your plugin to be notified upon Kettle Environment initialization and termination. This gives a plugin a chance to initialize at Kettle Environment initialization time.

Plugin Callbacks

A Kettle lifecycle listener plugin's callbacks will be executed at the following times:

  • KettleLifecycleListener.onEnvironmentInit(): During KettleEnvironment.init(), after plugins have been loaded but before the initialization flag has been set on KettleEnvironment. Throwing a severe LifecycleException during onEnvironmentInit() will prevent the Kettle Environment from initializing.
  • KettleLifecycleListener.onEnvironmentShutdown(): During JVM termination (specifically a Runtime shutdown hook). Throwing an exception from this method will have no effect.

Writing your plugin

A Kettle Lifecycle Listener Plugin may only be defined by annotation:

@KettleLifecyclePlugin(id="SampleKettleLifecyclePlugin", name="My First Kettle Environment Lifecycle Plugin")
public class SampleKettleLifecyclePlugin implements KettleLifecycleListener {
  @Override
  public void onEnvironmentInit() throws LifecycleException {
    System.out.println("SampleKettleLifecyclePlugin: Kettle Environment is initializing and I'm loaded!");
  }

  @Override
  public void onEnvironmentShutdown() {
    System.out.println("SampleKettleLifecyclePlugin: Kettle Environment shutting down!");
  }
}