pub struct Job<TKey, TMsg>{
pub key: TKey,
pub msg: TMsg,
pub options: JobOptions,
pub accepted: Option<RpcReplyPort<Option<Self>>>,
}Expand description
Represents a job sent to a factory
Depending on the super::Factory’s routing scheme the
Job’s key is utilized to dispatch the job to specific
workers.
Fields§
§key: TKeyThe key of the job
msg: TMsgThe message of the job
options: JobOptionsThe job’s options, mainly related to timing information of the job
Default = JobOptions::default()
accepted: Option<RpcReplyPort<Option<Self>>>If provided, this channel can be used to block pushes into the factory until the factory can “accept” the message into its internal processing. This can be used to synchronize external threadpools to the Tokio processing pool and prevent overloading the unbounded channel which fronts all actors.
The reply channel returns None if the job was accepted, or
Some(Job) if it was rejected and load-shed, and then the
job may be retried by the caller at a later time (if desired).
Default = None
Implementations§
Source§impl<TKey, TMsg> Job<TKey, TMsg>
impl<TKey, TMsg> Job<TKey, TMsg>
Sourcepub fn builder() -> JobBuilder<TKey, TMsg>
pub fn builder() -> JobBuilder<TKey, TMsg>
Create an instance of Job using the builder syntax
Source§impl<TKey, TMsg> Job<TKey, TMsg>
impl<TKey, TMsg> Job<TKey, TMsg>
Sourcepub fn new(key: TKey, message: TMsg) -> Self
pub fn new(key: TKey, message: TMsg) -> Self
Construct a job with default JobOptions.
Sourcepub fn with_options(key: TKey, message: TMsg, options: JobOptions) -> Self
pub fn with_options(key: TKey, message: TMsg, options: JobOptions) -> Self
Construct a job with explicit JobOptions.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Determine if this job’s TTL is expired
Expiration only takes effect prior to the job being started execution on a worker.