pub struct Drivers { /* private fields */ }Expand description
Queue driver factories, configured before the application boots.
A connection configured with ConnectionConfig::custom names its driver. The driver’s
factory creates the connection’s driver the first time a job is pushed to the connection or a
worker starts working it. A later registration replaces an earlier one with the same name,
including the built-in database, redis, sqs, and cloud drivers.
use laravel::Application;
use laravel::config::queue::ConnectionConfig;
Application::configure()
.with_config(|config, _| {
config.queue.add_connection("beanstalkd", ConnectionConfig::custom("beanstalkd"));
})
.with_services(|app| {
app.queue().extend("beanstalkd", |_app, _definition| {
BeanstalkdDriver::connect("127.0.0.1:11300")
});
});The factory runs once for each connection that uses the driver, and receives that connection’s
ConnectionDefinition. To use one driver differently in several connections, give each
connection its own settings, and read them in the factory with
ConnectionDefinition::settings.
Implementations§
Source§impl Drivers
impl Drivers
Sourcepub fn extend<D, F, Fut>(&mut self, name: &str, factory: F) -> &mut Drivers
pub fn extend<D, F, Fut>(&mut self, name: &str, factory: F) -> &mut Drivers
Register a driver factory under a case-insensitive name, and return self for more
registrations.
The factory replaces any factory already registered under the name. It receives the container, with the final configuration and asynchronous service resolution, and the definition of the connection it creates a driver for. The factory runs in its own context, as a service’s factory does. If the factory fails or panics, the push or worker that needed the connection fails, and the next push or worker calls the factory again.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Drivers
impl !UnwindSafe for Drivers
impl Forget for Drivers
impl Freeze for Drivers
impl Move for Drivers
impl Send for Drivers
impl Sync for Drivers
impl Unpin for Drivers
impl UnsafeUnpin for Driverswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, Arc<dyn Fn(Container, ConnectionDefinition) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ErasedDriver>, Error>> + Send>> + Sync + Send>)>: 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
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