package com.example.demo ;
import lombok.extern.slf4j.Slf4j ;
import org.activiti.api.task.runtime.TaskRuntime ;
import org.activiti.api.task.runtime.events.TaskAssignedEvent ;
import org.activiti.api.task.runtime.events.TaskCompletedEvent ;
import org.activiti.api.task.runtime.events.listener.TaskRuntimeEventListener ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.boot.SpringApplication ;
import org.springframework.boot.autoconfigure.SpringBootApplication ;
import org.springframework.context.annotation.Bean ;
@Slf4j
@SpringBootApplication ( exclude = { org . springframework . boot . autoconfigure . security . servlet . SecurityAutoConfiguration . class ,
org . springframework . boot . actuate . autoconfigure . security . servlet . ManagementWebSecurityAutoConfiguration . class } )
public class DemoApplication {
public static void main ( String [ ] args ) {
SpringApplication . run ( DemoApplication . class , args ) ;
}
@Autowired
private TaskRuntime taskRuntime ;
@Bean
public TaskRuntimeEventListener < TaskAssignedEvent > taskAssignedListener ( ) {
return taskAssigned - > log . info ( ">>> Task Assigned: '"
+ taskAssigned . getEntity ( ) . getName ( ) +
"' We can send a notification to the assginee: " + taskAssigned . getEntity ( ) . getAssignee ( ) ) ;
}
@Bean
public TaskRuntimeEventListener < TaskCompletedEvent > taskCompletedListener ( ) {
return taskCompleted - > log . info ( ">>> Task Completed: '"
+ taskCompleted . getEntity ( ) . getName ( ) +
"' We can send a notification to the owner: " + taskCompleted . getEntity ( ) . getOwner ( ) ) ;
}
}