Struct disque::AddJobBuilder

source ·
pub struct AddJobBuilder<'a> { /* private fields */ }
Expand description

Helper to add a new job

Examples


let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
let jobid = AddJobBuilder::new(b"example queue", b"my job", 10000
    ).delay(1440).run(&disque).unwrap();

Implementations§

source§

impl<'a> AddJobBuilder<'a>

source

pub fn new( queue_name: &'a [u8], job: &'a [u8], timeout_ms: u64 ) -> AddJobBuilder<'a>

Creates a new builder for queue_name. Timeout is specified in milliseconds.

source

pub fn queue_name(&mut self, queue_name: &'a [u8]) -> &mut Self

Changes the queue name where the job will be added.

source

pub fn job(&mut self, job: &'a [u8]) -> &mut Self

Changes the job body.

source

pub fn timeout(&mut self, timeout_ms: u64) -> &mut Self

Changes the timeout. It must be specified in milliseconds.

source

pub fn replicate(&mut self, replicate: usize) -> &mut Self

The number of nodes the job should be replicated to.

source

pub fn delay(&mut self, delay: u64) -> &mut Self

The number of seconds that should elapse before the job is queued.

source

pub fn retry(&mut self, retry: u64) -> &mut Self

Period after which, if no ACK is received, the job is put again into the queue for delivery

source

pub fn ttl(&mut self, ttl: u64) -> &mut Self

The max job life in seconds. After this time, the job is deleted even if it was not successfully delivered.

source

pub fn maxlen(&mut self, maxlen: usize) -> &mut Self

If there are already count messages queued for the specified queue name, the message is refused and an error reported to the client.

source

pub fn async(&mut self, async: bool) -> &mut Self

If true, asks the server to let the command return ASAP and replicate the job to other nodes in the background. Otherwise, the job is put into the queue only when the client gets a positive reply.

source

pub fn run(&self, disque: &Disque) -> RedisResult<String>

Executes the addjob command.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for AddJobBuilder<'a>

§

impl<'a> Send for AddJobBuilder<'a>

§

impl<'a> Sync for AddJobBuilder<'a>

§

impl<'a> Unpin for AddJobBuilder<'a>

§

impl<'a> UnwindSafe for AddJobBuilder<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.