Saturday, May 25, 2013

HumanTask Event Listeners - WSO2 BPS


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

  1. Build a jar file of including your listener.
  2. Copy it into /repository/components/lib. Where is the root directory of BPS server.
  3. Uncomment TaskEventListeners in HumanTask configuration file (/repository/conf/humantask.xml) and give your Event Listener class name for ClassName.
  4. eg:
    Note: you can have multiple listener classes.
  5. Start BPS.
  6. Execute a task.