Struct apalis_core::request::JobRequest
source · [−]pub struct JobRequest<T> { /* private fields */ }Expand description
Represents a job which can be pushed and popped into a Storage.
Its usually passed to a JobService for execution.
Implementations
sourceimpl<T> JobRequest<T>
impl<T> JobRequest<T>
sourcepub fn new(job: T) -> Self
pub fn new(job: T) -> Self
Creates a new JobRequest ready to be pushed to a Storage
sourcepub fn context_mut(&mut self) -> &mut JobContext
pub fn context_mut(&mut self) -> &mut JobContext
Gets a mutable reference to the job context.
sourcepub fn context(&self) -> &JobContext
pub fn context(&self) -> &JobContext
Gets a reference to the job context.
sourcepub fn max_attempts(&self) -> i32
pub fn max_attempts(&self) -> i32
Gets the maximum attempts for a job. Default 25
sourcepub fn record_attempt(&mut self)
pub fn record_attempt(&mut self)
Records a job attempt
Trait Implementations
sourceimpl<T: Clone> Clone for JobRequest<T>
impl<T: Clone> Clone for JobRequest<T>
sourceimpl<T: Debug> Debug for JobRequest<T>
impl<T: Debug> Debug for JobRequest<T>
sourceimpl<T> Deref for JobRequest<T>
impl<T> Deref for JobRequest<T>
sourceimpl<'de, T> Deserialize<'de> for JobRequest<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for JobRequest<T> where
T: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'r, T: DeserializeOwned> FromRow<'r, SqliteRow> for JobRequest<T>
impl<'r, T: DeserializeOwned> FromRow<'r, SqliteRow> for JobRequest<T>
sourceimpl<T> Policy<JobRequest<T>, JobResult, JobError> for DefaultRetryPolicy where
T: Clone,
impl<T> Policy<JobRequest<T>, JobResult, JobError> for DefaultRetryPolicy where
T: Clone,
type Future = Ready<DefaultRetryPolicy>
type Future = Ready<DefaultRetryPolicy>
The Future type returned by Policy::retry.
sourcefn retry(
&self,
req: &JobRequest<T>,
result: Result<&JobResult, &JobError>
) -> Option<Self::Future>
fn retry(
&self,
req: &JobRequest<T>,
result: Result<&JobResult, &JobError>
) -> Option<Self::Future>
Check the policy if a certain request should be retried. Read more
sourcefn clone_request(&self, req: &JobRequest<T>) -> Option<JobRequest<T>>
fn clone_request(&self, req: &JobRequest<T>) -> Option<JobRequest<T>>
Tries to clone a request before being passed to the inner service. Read more
sourceimpl<T> Serialize for JobRequest<T> where
T: Serialize,
impl<T> Serialize for JobRequest<T> where
T: Serialize,
sourceimpl<J, S, T> Service<JobRequest<J>> for AddExtension<S, T> where
S: Service<JobRequest<J>>,
T: Clone + Send + Sync + 'static,
impl<J, S, T> Service<JobRequest<J>> for AddExtension<S, T> where
S: Service<JobRequest<J>>,
T: Clone + Send + Sync + 'static,
type Response = <S as Service<JobRequest<J>>>::Response
type Response = <S as Service<JobRequest<J>>>::Response
Responses given by the service.
type Error = <S as Service<JobRequest<J>>>::Error
type Error = <S as Service<JobRequest<J>>>::Error
Errors produced by the service.
type Future = <S as Service<JobRequest<J>>>::Future
type Future = <S as Service<JobRequest<J>>>::Future
The future response value.
sourcefn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
sourcefn call(&mut self, req: JobRequest<J>) -> Self::Future
fn call(&mut self, req: JobRequest<J>) -> Self::Future
Process the request and return the response asynchronously. Read more
sourceimpl<Request> Service<JobRequest<Request>> for JobService where
Request: Debug + Job + 'static,
impl<Request> Service<JobRequest<Request>> for JobService where
Request: Debug + Job + 'static,
type Future = Pin<Box<dyn Future<Output = Result<<JobService as Service<JobRequest<Request>>>::Response, <JobService as Service<JobRequest<Request>>>::Error>> + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<JobService as Service<JobRequest<Request>>>::Response, <JobService as Service<JobRequest<Request>>>::Error>> + 'static, Global>>
The future response value.
sourcefn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
sourcefn call(&mut self, job: JobRequest<Request>) -> Self::Future
fn call(&mut self, job: JobRequest<Request>) -> Self::Future
Process the request and return the response asynchronously. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for JobRequest<T>
impl<T> Send for JobRequest<T> where
T: Send,
impl<T> Sync for JobRequest<T> where
T: Sync,
impl<T> Unpin for JobRequest<T> where
T: Unpin,
impl<T> !UnwindSafe for JobRequest<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more