https://grokonez.com/java-integration/activiti-event-listener-spring-boot-example

How to create Activiti Event Listener with Spring Boot Example

Activiti provides event mechanism that allows us to get notified when various events occur within the engine. In this tutorial, we’re gonna look at an example that uses Activiti Event Listener with Spring Boot.

Related Posts:

I. Activiti Event Listener Overview

1. Implementation

The first thing we have to do is implementing org.activiti.engine.delegate.event.ActivitiEventListener interface. You can find all supported event types at Activiti User Guide.

public class MyEventListener implements ActivitiEventListener {
@Override
public void onEvent(ActivitiEvent event) {
	switch (event.getType()) {

	case PROCESS_STARTED:
		// ...
		break;

	case PROCESS_COMPLETED:
		// ...
		break;

	// other EVENT_TYPE...

	default:
		break;
	}
}

@Override
public boolean isFailOnException() {
	
	return false;
}

}


isFailOnException() method will be called when onEvent() method throws an exception. Returning false means the exception is ignored.

All events dispatched are a subtype of org.activiti.engine.delegate.event.ActivitiEvent.
From the event, we can get (if available) type, executionId, processInstanceId and processDefinitionId.

2. Registering

The second thing we do is to register the ActivitiEventListener implementation above.

https://grokonez.com/java-integration/activiti-event-listener-spring-boot-example

How to create Activiti Event Listener with Spring Boot Example

#springboot #activiti #listener

How to create Activiti Event Listener with Spring Boot Example » grokonez
1.40 GEEK