pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.camundatest</groupId>
<artifactId>eventing-bridge-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Event Bridge Test</name>
<description>event bridge test</description>
<properties>
<version.camunda>7.14.0</version.camunda>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<version>${version.camunda}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>7.14.0</version>
</dependency>
<!-- redirect slf4j logging to jdk logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.26</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>camunda-bpm-nexus</id>
<name>camunda-bpm-nexus</name>
<url>https://app.camunda.com/nexus/content/groups/public</url>
</repository>
</repositories>
</project>
EventBridgeListener.java
package org.camunda.bpm.eventbridgelistener;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.impl.history.event.HistoryEvent;
import org.camunda.bpm.spring.boot.starter.event.TaskEvent;
import org.camunda.bpm.spring.boot.starter.event.ExecutionEvent;
import org.springframework.context.event.EventListener;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.springframework.stereotype.Component;
import java.util.logging.Logger;
@Component
class MyListener {
private final Logger LOGGER = Logger.getLogger(this.getClass().getName());
public EventBridgeListener() {
LOGGER.info("*** EventBridgeListener loaded");
}
@EventListener
public void onTaskEvent(DelegateTask taskDelegate) {
// handle mutable task event
LOGGER.info("**** EventBridgeListener onTaskEvent DelegateTask " + taskDelegate);
}
@EventListener
public void onUserTaskEvent(DelegateTask taskDelegate) {
// handle mutable task event
LOGGER.info("**** EventBridgeListener onUserTaskEvent DelegateTask " + taskDelegate);
}
@EventListener
public void onTaskEvent(TaskEvent taskEvent) {
// handle immutable task event
LOGGER.info("**** EventBridgeListener onTaskEvent TaskEvent " + taskEvent);
}
@EventListener
public void onExecutionEvent(DelegateExecution executionDelegate) {
// handle mutable execution event
LOGGER.info("**** EventBridgeListener onExecutionEvent DelegateExecution" + executionDelegate);
}
@EventListener
public void onExecutionEvent(ExecutionEvent executionEvent) {
// handle immutable execution event
LOGGER.info("**** EventBridgeListener onExecutionEvent ExecutionEvent" + executionEvent);
}
@EventListener
public void onHistoryEvent(HistoryEvent historyEvent) {
// handle history event
LOGGER.info("**** EventBridgeListener onHistoryEvent HistoryEvent" + historyEvent);
}
}