Skip to main content

Config

Struct Config 

Source
pub struct Config<DT, ET> {
    pub storage: Storage,
    /* private fields */
}

Fields§

§storage: Storage

Implementations§

Source§

impl<DT, ET> Config<DT, ET>

Source

pub fn new(storage: &Storage) -> Self

Creates a new configuration with default settings.

Source

pub fn register_queue<Q>(self) -> Self
where Q: Queue,

Registers a queue by its type.

Source

pub fn register_queue_with(&mut self, config: QueueConfig)

Registers a queue from a QueueConfig.

Source

pub fn register_queue_with_concurrency<Q>(self, concurrency: usize) -> Self
where Q: Queue,

Registers a queue by its type with a custom concurrency limit.

Source

pub fn register_worker<W, A>(self) -> Self
where W: Worker<A, Error = ET> + FromContext<DT> + 'static, A: Job + DeserializeOwned + Send + Sync + 'static, DT: Clone + Send + Sync + 'static, ET: Error + Send + Sync + 'static,

Registers a worker and its associated job type.

Source

pub fn register_worker_with(&mut self, config: WorkerConfig<DT, ET>)

Registers a worker from a WorkerConfig.

Source

pub fn exit_when_processed(self, processed: u64) -> Self

Stops processing after the given number of jobs have been processed. Useful for testing.

Source

pub fn with_graceful_shutdown( self, fut: impl Future<Output = Result<(), Error>> + Send + Sync + 'static, ) -> Self

Sets a future that triggers graceful shutdown when it completes. Defaults to listening for SIGTERM/SIGINT on Unix and Ctrl+C on Windows.

Source

pub fn with_retry_delay_override( self, f: impl Fn(&ET, u32, u64) -> Option<u64> + Send + Sync + 'static, ) -> Self

Sets a global callback to override the retry delay when a job fails.

The callback receives (error, retry_count, default_delay) and returns Some(seconds) to override or None to use the worker’s default.

Source

pub fn consume_shutdown_signal( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + Sync + 'static>>

Source

pub fn has_registered_queue<Q: Queue>(&self) -> bool

Returns true if the given queue type has been registered.

Source

pub fn has_registered_worker(&self, name: &str) -> bool

Returns true if a worker with the given name has been registered.

Source

pub fn has_registered_worker_type<W: 'static>(&self) -> bool

Returns true if a worker of the given type has been registered.

Source

pub fn has_registered_cron_worker(&self, name: &str) -> bool

Returns true if a cron worker with the given name has been registered.

Source

pub fn has_registered_cron_worker_type<W: 'static>(&self) -> bool

Returns true if a cron worker of the given type has been registered.

Source

pub fn catalog(&self) -> Catalog

Returns a catalog of all registered workers.

Auto Trait Implementations§

§

impl<DT, ET> Freeze for Config<DT, ET>

§

impl<DT, ET> !RefUnwindSafe for Config<DT, ET>

§

impl<DT, ET> Send for Config<DT, ET>

§

impl<DT, ET> Sync for Config<DT, ET>

§

impl<DT, ET> Unpin for Config<DT, ET>

§

impl<DT, ET> UnsafeUnpin for Config<DT, ET>

§

impl<DT, ET> !UnwindSafe for Config<DT, ET>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more