camunda-community-hub / camunda-platform-7-reactor

Event Driven process applications
https://camunda.github.io/camunda-bpm-reactor/
Apache License 2.0
80 stars 34 forks source link

TaskListener event for "timeout" does not invoked! #101

Closed caiya closed 4 years ago

caiya commented 4 years ago

while i use task timeout listener, define task duedate in bpmn file, and work with bellow: ` @Component @CamundaSelector(type = "userTask", event = TaskListener.EVENTNAME_TIMEOUT) @Slf4j public class TaskTimeoutListener implements TaskListener { public TaskTimeoutListener(CamundaEventBus eventBus) { eventBus.register(this); }

@Override
public void notify(DelegateTask delegateTask) {
    log.debug("【TaskTimeoutListener】: {} 超期了...", delegateTask.getName());
}

} `

but i tryed several times, this block code does not be invoked, it means it does not work!

jangalinski commented 4 years ago

so ... this works as expected?

abdulfousan commented 3 years ago

Please reopen this issue, still event not occurring

@Component
@CamundaSelector(event = TaskListener.EVENTNAME_TIMEOUT)
public class TaskTimeoutListener extends ReactorTaskListener {

    private final static Logger LOGGER = Logger.getLogger(TaskAssignmentListener.class.getName());

    @Autowired
    EmailService emailService;

    public void notify(DelegateTask delegateTask) {

        String assignee = delegateTask.getAssignee();
        String taskId = delegateTask.getId();

        LOGGER.info("TaskTimeoutListener " + assignee+" - "+taskId);

        if (assignee != null) {

            // Get User Profile from User Management
            IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();
            User user = identityService.createUserQuery().userId(assignee).singleResult();

            if (user != null) {

                // Get Email Address from User Profile
                String recipient = user.getEmail();

                if (recipient != null && !recipient.isEmpty()) {

                    EmailService.sendEmail(taskId, recipient, delegateTask);

                } else {
                    LOGGER.warning("Not sending email to user " + assignee + "', user has no email address.");
                }

            } else {
                LOGGER.warning(
                        "Not sending email to user " + assignee + "', user is not enrolled with identity service.");
            }

        }

    }

}