@EndSaga @SagaEventHandler(associationProperty = "todoId") public void onToDoItemCompleted(ToDoItemCompletedEvent event) { if (deadline != null) { eventScheduler.cancelSchedule(deadline); } }
@StartSaga @SagaEventHandler(associationProperty = "todoId") public void onToDoItemCreated(ToDoItemCreatedEvent event) { deadline = eventScheduler.schedule( Duration.standardSeconds(2), new ToDoItemDeadlineExpiredEvent(event.getTodoId())); }