pub struct Queue {
pub default: String,
pub connections: BTreeMap<String, ConnectionConfig>,
pub failed: FailedJobs,
pub batches: DatabaseBatches,
}Expand description
The named queue connections, each using a driver, and where failed jobs and batches are kept.
| Field | Variable | Default |
|---|---|---|
default | QUEUE_CONNECTION | database |
connections | database, redis, sqs, sync, and discard, plus cloud on Laravel Cloud | |
failed | DB_QUEUE_FAILED_CONNECTION, DB_QUEUE_FAILED_TABLE | The failed_jobs table |
The database connection reads DB_QUEUE_CONNECTION, DB_QUEUE_TABLE, and DB_QUEUE. The
redis connection reads REDIS_QUEUE_CONNECTION and REDIS_QUEUE, and the sqs connection
reads the variables that SqsQueue::from_env lists. Laravel Cloud sets
LARAVEL_CLOUD_MANAGED_QUEUES_CONFIG for an application with managed queues. When that
variable is set, the cloud connection uses the managed queues it describes. Reading the
configuration doesn’t open any connection.
use laravel::config::queue::{DatabaseQueue, Queue};
use laravel::config::{self, Env};
#[config::section]
fn queue(env: &Env) -> Queue {
let mut queue = Queue::from_env(env);
queue.add_connection(
"reports",
DatabaseQueue::new().connection("reporting").queue("reports"),
);
queue
}Fields§
§default: StringThe name of the connection that jobs are dispatched to when they don’t choose one.
connections: BTreeMap<String, ConnectionConfig>The connections, keyed by name.
failed: FailedJobsWhere jobs that have failed for good are kept, so you can retry them.
batches: DatabaseBatchesWhere batches keep their job counts and the outcome of each of their jobs.
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn from_env(env: &Env) -> Queue
pub fn from_env(env: &Env) -> Queue
Reads the section from the environment, starting from its defaults.
Sourcepub fn add_connection(
&mut self,
name: impl Into<String>,
connection: impl Into<ConnectionConfig>,
) -> &mut Queue
pub fn add_connection( &mut self, name: impl Into<String>, connection: impl Into<ConnectionConfig>, ) -> &mut Queue
Adds a named connection, replacing any connection with the same name.
use laravel::config::queue::{ConnectionConfig, DatabaseQueue, Queue};
let mut queue = Queue::default();
queue.add_connection("testing", ConnectionConfig::Sync);
queue.add_connection("reports", DatabaseQueue::new().table("report_jobs"));Trait Implementations§
impl Eq for Queue
impl StructuralPartialEq for Queue
Auto Trait Implementations§
impl !RefUnwindSafe for Queue
impl !UnwindSafe for Queue
impl Forget for Queue
impl Freeze for Queuewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, ConnectionConfig> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, ConnectionConfig)>>: Freeze,
impl Move for Queue
impl Send for Queuewhere
RawVecInner: Send,
NodeRef<Owned, String, ConnectionConfig, LeafOrInternal>: Send,
BoxRaw<(String, ConnectionConfig)>: Send,
impl Sync for Queuewhere
RawVecInner: Sync,
NodeRef<Owned, String, ConnectionConfig, LeafOrInternal>: Sync,
BoxRaw<(String, ConnectionConfig)>: Sync,
impl Unpin for Queue
impl UnsafeUnpin for Queuewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, ConnectionConfig> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, ConnectionConfig)>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more