This adds a facility for setting shared state on jobs via the state method on the job builder. When state is provided, the execute function must accept input and state, in that order, as arguments.
Shared state is useful in a number of ways, including when resources like database pools, should be accessible to your jobs.
Furthermore, patterns like Arc<Mutex<T>> enable shared mutable state, where necessary.
This adds a facility for setting shared state on jobs via the
state
method on the job builder. When state is provided, the execute function must accept input and state, in that order, as arguments.Shared state is useful in a number of ways, including when resources like database pools, should be accessible to your jobs.
Furthermore, patterns like
Arc<Mutex<T>>
enable shared mutable state, where necessary.