pub struct QueueConfig {
pub redis_url: String,
pub default_queue: String,
pub prefix: String,
pub block_timeout: Duration,
pub max_concurrent_jobs: usize,
pub delayed_job_poll_interval: Duration,
}Expand description
Queue system configuration.
Fields§
§redis_url: StringRedis connection URL.
default_queue: StringDefault queue name.
prefix: StringPrefix for queue keys in Redis.
block_timeout: DurationHow long to block waiting for jobs (in seconds).
max_concurrent_jobs: usizeMaximum number of concurrent jobs per worker.
delayed_job_poll_interval: DurationHow often to check for delayed jobs.
Implementations§
Source§impl QueueConfig
impl QueueConfig
Sourcepub fn new(redis_url: impl Into<String>) -> QueueConfig
pub fn new(redis_url: impl Into<String>) -> QueueConfig
Create a new configuration with a Redis URL.
Sourcepub fn from_env() -> QueueConfig
pub fn from_env() -> QueueConfig
Create configuration from environment variables.
Reads the following environment variables:
QUEUE_CONNECTION: “sync” or “redis” (defaults to “sync”)QUEUE_DEFAULT: Default queue name (defaults to “default”)QUEUE_PREFIX: Key prefix in Redis (defaults to “ferro_queue”)QUEUE_BLOCK_TIMEOUT: Seconds to block waiting for jobs (defaults to 5)QUEUE_MAX_CONCURRENT: Max concurrent jobs per worker (defaults to 10)REDIS_URL: Full Redis URL (takes precedence if set)REDIS_HOST: Redis host (defaults to “127.0.0.1”)REDIS_PORT: Redis port (defaults to 6379)REDIS_PASSWORD: Redis password (optional)REDIS_DATABASE: Redis database number (defaults to 0)
§Example
use ferro_queue::QueueConfig;
// In bootstrap.rs
let config = QueueConfig::from_env();
Queue::init(config).await?;Sourcepub fn is_sync_mode() -> bool
pub fn is_sync_mode() -> bool
Check if sync queue mode is configured.
When QUEUE_CONNECTION=sync, jobs are processed immediately instead of being pushed to Redis.
Sourcepub fn default_queue(self, queue: impl Into<String>) -> QueueConfig
pub fn default_queue(self, queue: impl Into<String>) -> QueueConfig
Set the default queue name.
Sourcepub fn prefix(self, prefix: impl Into<String>) -> QueueConfig
pub fn prefix(self, prefix: impl Into<String>) -> QueueConfig
Set the key prefix.
Sourcepub fn block_timeout(self, timeout: Duration) -> QueueConfig
pub fn block_timeout(self, timeout: Duration) -> QueueConfig
Set the block timeout.
Sourcepub fn max_concurrent_jobs(self, count: usize) -> QueueConfig
pub fn max_concurrent_jobs(self, count: usize) -> QueueConfig
Set max concurrent jobs.
Sourcepub fn delayed_key(&self, queue: &str) -> String
pub fn delayed_key(&self, queue: &str) -> String
Get the Redis key for delayed jobs.
Sourcepub fn reserved_key(&self, queue: &str) -> String
pub fn reserved_key(&self, queue: &str) -> String
Get the Redis key for reserved jobs.
Sourcepub fn failed_key(&self) -> String
pub fn failed_key(&self) -> String
Get the Redis key for failed jobs.
Trait Implementations§
Source§impl Clone for QueueConfig
impl Clone for QueueConfig
Source§fn clone(&self) -> QueueConfig
fn clone(&self) -> QueueConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueueConfig
impl Debug for QueueConfig
Source§impl Default for QueueConfig
impl Default for QueueConfig
Source§fn default() -> QueueConfig
fn default() -> QueueConfig
Auto Trait Implementations§
impl Freeze for QueueConfig
impl RefUnwindSafe for QueueConfig
impl Send for QueueConfig
impl Sync for QueueConfig
impl Unpin for QueueConfig
impl UnsafeUnpin for QueueConfig
impl UnwindSafe for QueueConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);