kagkarlsson / db-scheduler

Persistent cluster-friendly scheduler for Java
Apache License 2.0
1.23k stars 188 forks source link

feat: New interface SchedulerListener #504

Closed kagkarlsson closed 1 month ago

kagkarlsson commented 2 months ago

Replaces the old StatsRegistry and adds more detailed events:

  void onExecutionScheduled(TaskInstanceId taskInstanceId, Instant executionTime);
  void onExecutionStart(CurrentlyExecuting currentlyExecuting);
  void onExecutionComplete(ExecutionComplete executionComplete);
  void onExecutionDead(Execution execution);
  void onExecutionFailedHeartbeat(CurrentlyExecuting currentlyExecuting);

Additionally adds ExecutionInterceptor as a way of injecting wrapping-logic for all executions.

  CompletionHandler<?> execute(
      TaskInstance<?> taskInstance, ExecutionContext executionContext, ExecutionChain chain);

Fixes

kagkarlsson commented 2 months ago

Tbh I am starting to feel an interceptor/filter/decorator approach is more flexible for injecting logic before and after execution 🤔 (since we still have start-variables in scope after execution is done)

kagkarlsson commented 2 weeks ago

🎉 This issue has been resolved in v14.1.0 (Release Notes)