pub struct CeleryConfig {Show 33 fields
pub broker_url: String,
pub result_backend: Option<String>,
pub task_serializer: String,
pub result_serializer: String,
pub accept_content: Vec<String>,
pub timezone: String,
pub enable_utc: bool,
pub task_track_started: bool,
pub task_send_sent_event: bool,
pub task_acks_late: bool,
pub task_reject_on_worker_lost: bool,
pub worker_concurrency: usize,
pub worker_prefetch_multiplier: usize,
pub worker_max_tasks_per_child: Option<usize>,
pub worker_max_memory_per_child: Option<usize>,
pub worker_heartbeat: u64,
pub task_default_queue: String,
pub task_default_exchange: String,
pub task_default_exchange_type: String,
pub task_default_routing_key: String,
pub task_routes: HashMap<String, TaskRoute>,
pub task_time_limit: Option<u64>,
pub task_soft_time_limit: Option<u64>,
pub task_default_retry_delay: u64,
pub task_max_retries: u32,
pub result_expires: u64,
pub result_compression: Option<String>,
pub result_compression_threshold: usize,
pub task_annotations: HashMap<String, TaskConfig>,
pub broker_transport_options: BrokerTransport,
pub result_backend_transport_options: BackendTransport,
pub beat_schedule: HashMap<String, BeatSchedule>,
pub custom: HashMap<String, Value>,
}Expand description
Celery-compatible main configuration
Fields§
§broker_url: StringBroker connection URL (CELERY_BROKER_URL)
result_backend: Option<String>Result backend URL (CELERY_RESULT_BACKEND)
task_serializer: StringTask serializer format (CELERY_TASK_SERIALIZER)
result_serializer: StringResult serializer format (CELERY_RESULT_SERIALIZER)
accept_content: Vec<String>Accepted content types (CELERY_ACCEPT_CONTENT)
timezone: StringTimezone for scheduling (CELERY_TIMEZONE)
enable_utc: boolUse UTC timestamps (CELERY_ENABLE_UTC)
task_track_started: boolTrack task started events (CELERY_TASK_TRACK_STARTED)
task_send_sent_event: boolSend task sent events (CELERY_TASK_SEND_SENT_EVENT)
task_acks_late: boolAcknowledge tasks late (CELERY_TASK_ACKS_LATE)
task_reject_on_worker_lost: boolReject on worker lost (CELERY_TASK_REJECT_ON_WORKER_LOST)
worker_concurrency: usizeWorker concurrency (CELERYD_CONCURRENCY)
worker_prefetch_multiplier: usizeWorker prefetch multiplier (CELERYD_PREFETCH_MULTIPLIER)
worker_max_tasks_per_child: Option<usize>Maximum tasks per child before restart (CELERYD_MAX_TASKS_PER_CHILD)
worker_max_memory_per_child: Option<usize>Maximum memory per child in KB (CELERYD_MAX_MEMORY_PER_CHILD)
worker_heartbeat: u64Worker heartbeat interval in seconds (CELERY_WORKER_HEARTBEAT)
task_default_queue: StringTask default queue (CELERY_DEFAULT_QUEUE)
task_default_exchange: StringTask default exchange (CELERY_DEFAULT_EXCHANGE)
task_default_exchange_type: StringTask default exchange type (CELERY_DEFAULT_EXCHANGE_TYPE)
task_default_routing_key: StringTask default routing key (CELERY_DEFAULT_ROUTING_KEY)
task_routes: HashMap<String, TaskRoute>Task routes (CELERY_TASK_ROUTES)
task_time_limit: Option<u64>Task time limit in seconds (CELERY_TASK_TIME_LIMIT)
task_soft_time_limit: Option<u64>Task soft time limit in seconds (CELERY_TASK_SOFT_TIME_LIMIT)
task_default_retry_delay: u64Task default retry delay in seconds (CELERY_TASK_DEFAULT_RETRY_DELAY)
task_max_retries: u32Task max retries (CELERY_TASK_MAX_RETRIES)
result_expires: u64Result expires in seconds (CELERY_RESULT_EXPIRES)
result_compression: Option<String>Result compression (CELERY_RESULT_COMPRESSION)
result_compression_threshold: usizeResult compression threshold in bytes
task_annotations: HashMap<String, TaskConfig>Task-specific configurations
broker_transport_options: BrokerTransportBroker transport options (CELERY_BROKER_TRANSPORT_OPTIONS)
result_backend_transport_options: BackendTransportResult backend transport options
beat_schedule: HashMap<String, BeatSchedule>Beat schedule configuration (CELERYBEAT_SCHEDULE)
custom: HashMap<String, Value>Custom configuration extensions
Implementations§
Source§impl CeleryConfig
impl CeleryConfig
Sourcepub fn with_broker_url(self, url: impl Into<String>) -> Self
pub fn with_broker_url(self, url: impl Into<String>) -> Self
Set broker URL
Sourcepub fn with_result_backend(self, url: impl Into<String>) -> Self
pub fn with_result_backend(self, url: impl Into<String>) -> Self
Set result backend URL
Sourcepub fn with_task_serializer(self, serializer: impl Into<String>) -> Self
pub fn with_task_serializer(self, serializer: impl Into<String>) -> Self
Set task serializer
Sourcepub fn with_result_serializer(self, serializer: impl Into<String>) -> Self
pub fn with_result_serializer(self, serializer: impl Into<String>) -> Self
Set result serializer
Sourcepub fn with_accept_content(self, content: Vec<String>) -> Self
pub fn with_accept_content(self, content: Vec<String>) -> Self
Set accepted content types
Sourcepub fn with_timezone(self, tz: impl Into<String>) -> Self
pub fn with_timezone(self, tz: impl Into<String>) -> Self
Set timezone
Sourcepub const fn with_enable_utc(self, enabled: bool) -> Self
pub const fn with_enable_utc(self, enabled: bool) -> Self
Enable/disable UTC
Sourcepub const fn with_worker_concurrency(self, concurrency: usize) -> Self
pub const fn with_worker_concurrency(self, concurrency: usize) -> Self
Set worker concurrency
Sourcepub const fn with_prefetch_multiplier(self, multiplier: usize) -> Self
pub const fn with_prefetch_multiplier(self, multiplier: usize) -> Self
Set worker prefetch multiplier
Sourcepub fn with_default_queue(self, queue: impl Into<String>) -> Self
pub fn with_default_queue(self, queue: impl Into<String>) -> Self
Set default queue name
Sourcepub fn with_task_route(self, task: impl Into<String>, route: TaskRoute) -> Self
pub fn with_task_route(self, task: impl Into<String>, route: TaskRoute) -> Self
Add task route
Sourcepub fn with_task_annotation(
self,
task: impl Into<String>,
config: TaskConfig,
) -> Self
pub fn with_task_annotation( self, task: impl Into<String>, config: TaskConfig, ) -> Self
Add task annotation
Sourcepub const fn with_result_expires(self, expires: u64) -> Self
pub const fn with_result_expires(self, expires: u64) -> Self
Set result expiration
Sourcepub fn with_result_compression(self, algorithm: impl Into<String>) -> Self
pub fn with_result_compression(self, algorithm: impl Into<String>) -> Self
Enable result compression
Sourcepub const fn with_compression_threshold(self, threshold: usize) -> Self
pub const fn with_compression_threshold(self, threshold: usize) -> Self
Set compression threshold
Sourcepub fn with_beat_schedule(
self,
name: impl Into<String>,
schedule: BeatSchedule,
) -> Self
pub fn with_beat_schedule( self, name: impl Into<String>, schedule: BeatSchedule, ) -> Self
Add beat schedule
Sourcepub fn get_task_config(&self, task_name: &str) -> Option<&TaskConfig>
pub fn get_task_config(&self, task_name: &str) -> Option<&TaskConfig>
Get task configuration for a specific task
Sourcepub fn get_task_route(&self, task_name: &str) -> Option<&TaskRoute>
pub fn get_task_route(&self, task_name: &str) -> Option<&TaskRoute>
Get task route for a specific task
Sourcepub const fn result_expires_duration(&self) -> Duration
pub const fn result_expires_duration(&self) -> Duration
Get result expiration duration
Sourcepub fn task_time_limit_duration(&self) -> Option<Duration>
pub fn task_time_limit_duration(&self) -> Option<Duration>
Get task time limit duration
Sourcepub fn task_soft_time_limit_duration(&self) -> Option<Duration>
pub fn task_soft_time_limit_duration(&self) -> Option<Duration>
Get task soft time limit duration
Trait Implementations§
Source§impl Clone for CeleryConfig
impl Clone for CeleryConfig
Source§fn clone(&self) -> CeleryConfig
fn clone(&self) -> CeleryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more