01-30-2021 04:23 PM
Hello,
I just want to ask how i can implement a listeners for activities using activiti 7 cloud.
tried to put this code in the runtime-bundle docker image but it it seems not working:
import java.util.HashMap;
import java.util.Map;
import org.activiti.api.process.model.payloads.SetProcessVariablesPayload;
import org.activiti.api.process.runtime.ProcessRuntime;
import org.activiti.api.task.runtime.events.TaskAssignedEvent;
import org.activiti.api.task.runtime.events.listener.TaskRuntimeEventListener;
import org.springframework.beans.factory.annotation.Autowired;
public class TaskAssagnedEventListener implements TaskRuntimeEventListener<TaskAssignedEvent>{
@Autowired
ProcessRuntime processRuntime;
@override
public void onEvent(TaskAssignedEvent event) {
Map<String,Object> vars = new HashMap();
System.out.println("Setting the Reminder ...");
vars.put("reminder", event.getEntity().getAssignee());
SetProcessVariablesPayload payload = new SetProcessVariablesPayload();
payload.setProcessInstanceId(event.getProcessInstanceId());
payload.setVariables(vars);
processRuntime.setVariables(payload);
}
}
is the runtime-bundle is the right place?
something not working with my implementation? or something should to be configured ?
Many Thanks.
Explore our Alfresco products with the links below. Use labels to filter content by product module.