Since 2.10
This feature allows you to specify Groovy code, which decides when the event is created. Subsequently specified task is processed. So for each listener user specifies Groovy source code and task which will be processed if groovy code decides to.
Table 8.1. Attributes of Universal message task
| Attribute | Description |
|---|---|
| Node ID to handle the event | This attribute makes sense only in cluster environment. It is node ID where the listener should be initialized. If it is not set, listener is initialized on all nodes in the cluster. |
| Interval of check in seconds | Periodicity of Groovy code execution. |
| Groovy code | Groovy code is used for deciding whether the event should be created or not. See below for details about groovy code. |
Groovy code is used for deciding whether the event should be created or not.
i.e. it may do some checks of data sources, which are vital for execution of graph. Or it may do some complex checks of running graph and make decision to kill it. It may call CloverETL Server core functions using ServerFacade interface, which is described in its own chapter.
Creating "event" is simple. If Groovy code returns Boolean.TRUE, event is created and specified task is processed. Otherwise, nothing happens. If groovy code throws an exception, it is considered as coding error and event is NOT created because of it. So if it is necessary, the exceptions must be handled in groovy code.
Table 8.2. Variables accessible in groovy code
| type | key | description |
|---|---|---|
| java.util.Properties | properties | Empty container which may be filled by String-String key-value pairs in your Groovy code. It is passed to the task which may use them somehow. I.e. task "execute graph" passes these parameters to the executed graph. |
| java.util.Map<String, Object> | data | Empty container which may be filled by String-Object key-value pairs in your Groovy code. It is passed to the task which may use them somehow according to its implementation. I.e. task "execute graph" passes it to the executed graph as "dictionary entries". Please note that it is not serializable, thus if the task is relying on it, it can be processed properly only on the same cluster node. |
| javax.servlet.ServletContext | servletContext | instance of ServletContext |
| com.cloveretl.server.api.ServerFacade | serverFacade | instance of serverFacade usable for calling CloverETL Server core features. |
| String | sessionToken | sessionToken, needed for calling serverFacade methods |