Implement set-listener and remove-listener API to listen to various lifecycle stages of a trigger.
The set-listeners API can be invoked to add a listener to any trigger at any stage of its execution. The parameters are :
- ‘name’ - a unique string identifying the listener so that it can be read, updated and removed
- ‘trigger’ - the name of the trigger to listen to
- ‘stage’ - the stage of the trigger (multiple values can be specified as an array of strings), possible values are:
- ‘beforeAction’ - the action name before which the listener should be notified. Multiple values can be specified as an array of strings.
- ‘afterAction’ - the action name after which the listener should be notified. Multiple values can be specified as an array of strings
- ‘class’ - an implementation of ‘TriggerListener’ class
- Other parameters depend on the listener class
An example invocation of this API is: