[−][src]Struct dbq::Queue
Represents a job queue stored in the database. Because the queue is stored in the database, the queue should be considered to have internal mutability
Examples
use dbq::{Queue, SchemaConfig}; use postgres::{Connection, TlsMode}; use serde_json::value::Value; let q = Queue::new(SchemaConfig::default(), "de_lancie_q".to_string()); let conn = Connection::connect("postgres://user@localhost".to_string(), TlsMode::None) .unwrap(); q.enqueue("send_email", Value::String("example@example.com".to_string()), 3, &conn); q.enqueue("send_sms", Value::String("+1-555-555-5555".to_string()), 3, &conn);
Methods
impl Queue
[src]
pub fn new(schema_config: SchemaConfig, name: String) -> Queue
[src]
pub fn enqueue<A: Serialize, C: GenericConnection>(
&self,
class: &str,
args: A,
max_attempts: u32,
conn: &C
) -> Result<u64>
[src]
&self,
class: &str,
args: A,
max_attempts: u32,
conn: &C
) -> Result<u64>
Add a new job to the queue
pub fn len<C: GenericConnection>(&self, conn: &C) -> Result<usize>
[src]
Length of the queue
pub fn lookup_in_queue<C: GenericConnection>(
&self,
job_id: u64,
conn: &C
) -> Result<Option<Job>>
[src]
&self,
job_id: u64,
conn: &C
) -> Result<Option<Job>>
Find a job in the queue by its job ID
pub fn lookup_in_dead_letters<C: GenericConnection>(
&self,
job_id: u64,
conn: &C
) -> Result<Option<Job>>
[src]
&self,
job_id: u64,
conn: &C
) -> Result<Option<Job>>
Find a job in the queue's "dead letter" storage by its job ID
pub fn clear<C: GenericConnection>(&self, conn: &C) -> Result<()>
[src]
Delete all jobs from the queue. Calling this function may block until all running jobs in the queue finish
Trait Implementations
impl Clone for Queue
[src]
fn clone(&self) -> Queue
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Queue
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self