You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an official way to use external transactions inside custom handlers (FailureHandler, CompletionHandler etc.)?
ClientScheduler is not allowed to modify currently picked task and methods on ExecutionOperations are automatically commiting because they use internal TaskRepository.
Therefore currently there seems to be no way to atomically create a new task and also cancel or reschedule the task for which handler was called for.
Dummy example of the thing I'm talking about:
@Component
public class ExampleFailureHandler implements FailureHandler<String> {
public static final TaskWithDataDescriptor<String> OTHER_TASK = new TaskWithDataDescriptor<>(
"OtherJob",
String.class
);
@Autowired
@Lazy
private SchedulerClient schedulerClient;
@Override
@Transactional
public void onFailure(ExecutionComplete executionComplete, ExecutionOperations<String> executionOperations) {
executionOperations.stop();
schedulerClient.schedule(OTHER_TASK.instance(UUID.randomUUID().toString(), ""), Instant.now());
}
}
By the time schedule method fails the currently processed task will be already gone.
Is it still not supported as per #276 or am I doing something wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Is there an official way to use external transactions inside custom handlers (FailureHandler, CompletionHandler etc.)?
ClientScheduler is not allowed to modify currently picked task and methods on ExecutionOperations are automatically commiting because they use internal TaskRepository.
Therefore currently there seems to be no way to atomically create a new task and also cancel or reschedule the task for which handler was called for.
Dummy example of the thing I'm talking about:
By the time schedule method fails the currently processed task will be already gone.
Is it still not supported as per #276 or am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions