Retry patten/mechanism for user task

Hi,
I have a BPMN model which contains a user Task ( UT) with a taskListner ( called when UT is completed) .
.

public void notify(DelegateTask delegateTask) {
  //a custom Java logic
  do something ;
  ..........
 }

The problem that my code (do something) can throw a exception, and I want in this case to reassign the task to the same user (Retry mechanism: require the user to try again to complete this task ).

How can I do that ? ( Knowing that notify() method doesn’t accept " throws Exception"
clause).

NB: I found a ugly method to do it,but i don’t like it !

 public void notify(DelegateTask delegateTask) {
     
        try{
             //a custom Java logic
              do something ;
              ..........
            } catch (Exception e) {
        		taskService.setVariable(delegateTask.getId(), "result", "Exception);
        		logger.error(e.getMessage());
        	}

You could put an error boundary event on your user task so that you can throw a bpmn error in your delegate and route it back to your task, but you’ll probably dislike it for the same reason :joy: So that begs the question, what do you not like about it?

I think your real problem is going to be the potential corner case where you get stuck in this loop forever for some reason. You may want to model yourself a way out of that flow. Or have the option to escalate somewhere in that exception path. That may ease your concerns.