Search code examples
javaactivitibpmn

No activity events when using the Java API


I'm using actviti with an implementation of ActivitiEventListener, which handles events such as ACTIVTI_COMPLETED/TASK_CREATED etc.

When communicating with process instances, I can see that the aforementioned events are fired (in ACT_EVT_LOG table), but when I do so via the Java API, no events are fired (e.g. when sending a message that a boundary event catches).

Below is a code snippet:

public static void main(String[] args) {
    readProperties();
    processEngine = buildProcessEngine();
    processEngine.getRuntimeService()
            .addEventListener(new ActivitiEventHandler("localhost", "61616"));
    new MessageSender(processEngine).sendMessage(args);
}

What am I missing here?


Solution

  • In case anyone would come across the same problem -

    This was a misunderstanding: I presumed that all events would show up in the ACT_EVT_LOG table, not knowing that there's a registered event listener that popoulates it. After not seeing the expected events in the table I thought that activiti doesn't dispatch them, when in reality they were dispatched but had no indication.

    So I added the following line, which made activiti populate ACT_EVT_LOG:

    runtimeService.addEventListener(new EventLogger(processEngine.getProcessEngineConfiguration().getClock()));