HumanTask engine comes with a humantask event generator. These task events are generated when a task goes trough a state transition. An event contains details about tasks and its state transition. So by writing a custom event listener to these events, a developer can easily enhance the HumanTask engine's functionalities.
What developer can do with a task event listener.
- Can do custom java code/ web service invocations.
- Can retrieve task information.
- Developer free to implement their own logic depending on their requirement.
Sample Event Listener.
EventListener class should implement HumanTaskEventListener class and onEvent method. See following sample code.
How to deploy a custom listener to WSO2 BPS
- Build a jar file of including your listener.
- Copy it into
/repository/components/lib. Where is the root directory of BPS server. - Uncomment TaskEventListeners in HumanTask configuration file (
/repository/conf/humantask.xml) and give your Event Listener class name for ClassName.
eg:
- Start BPS.
- Execute a task.
Note: you can have multiple listener classes.