pub type StateChangeHook = Arc<dyn Fn(&Job, &JobState, &JobState) + Send + Sync>;Expand description
Callback invoked after every persisted job state transition driven by the processor. Receives the job (with its new state already applied), the previous state, and the new state.
Held as an Arc<dyn Fn…> so one hook can be cloned across every worker
thread without additional allocation. The callback runs synchronously
inside process_job; keep it non-blocking — offload anything
expensive to a channel or a spawned task.
Fires exactly once per persisted transition, after the in-memory
Job has its new state and before storage.update(...). The
intermediate Failed step the state machine forces between
Processing and AwaitingRetry is not observed — the hook sees
the logical transition from the pre-retry state directly to
AwaitingRetry, matching what storage ends up holding.
Aliased Type§
pub struct StateChangeHook { /* private fields */ }