pub struct BeatBuilder<Sb>where
Sb: SchedulerBackend,{ /* private fields */ }
Expand description
Used to create a Beat
app with a custom configuration.
§Choosing a backend
LocalSchedulerBackend
keeps all scheduling state in memory and is intended for single-instance deployments.RedisSchedulerBackend
persists state in Redis and coordinates leadership across multiple beat instances using Redis locks. When using the Redis backend you can further tweakRedisBackendConfig
to customise the lock key prefix, lock timeout, renewal interval, follower polling interval, etc.
Implementations§
Source§impl BeatBuilder<LocalSchedulerBackend>
impl BeatBuilder<LocalSchedulerBackend>
Sourcepub fn with_default_scheduler_backend(name: &str, broker_url: &str) -> Self
pub fn with_default_scheduler_backend(name: &str, broker_url: &str) -> Self
Get a BeatBuilder
for creating a Beat
app with a default scheduler backend
and a custom configuration.
Source§impl<Sb> BeatBuilder<Sb>where
Sb: SchedulerBackend,
impl<Sb> BeatBuilder<Sb>where
Sb: SchedulerBackend,
Sourcepub fn with_custom_scheduler_backend(
name: &str,
broker_url: &str,
scheduler_backend: Sb,
) -> Self
pub fn with_custom_scheduler_backend( name: &str, broker_url: &str, scheduler_backend: Sb, ) -> Self
Get a BeatBuilder
for creating a Beat
app with a custom scheduler backend and
a custom configuration.
Sourcepub fn default_queue(self, queue_name: &str) -> Self
pub fn default_queue(self, queue_name: &str) -> Self
Set the name of the default queue to something other than “celery”.
Sourcepub fn heartbeat(self, heartbeat: Option<u16>) -> Self
pub fn heartbeat(self, heartbeat: Option<u16>) -> Self
Set the broker heartbeat. The default value depends on the broker implementation.
Sourcepub fn task_route(self, pattern: &str, queue: &str) -> Self
pub fn task_route(self, pattern: &str, queue: &str) -> Self
Add a routing rule.
Sourcepub fn broker_connection_timeout(self, timeout: u32) -> Self
pub fn broker_connection_timeout(self, timeout: u32) -> Self
Set a timeout in seconds before giving up establishing a connection to a broker.
Sourcepub fn broker_connection_retry(self, retry: bool) -> Self
pub fn broker_connection_retry(self, retry: bool) -> Self
Set whether or not to automatically try to re-establish connection to the AMQP broker.
Sourcepub fn broker_connection_max_retries(self, max_retries: u32) -> Self
pub fn broker_connection_max_retries(self, max_retries: u32) -> Self
Set the maximum number of retries before we give up trying to re-establish connection to the AMQP broker.
Sourcepub fn broker_connection_retry_delay(self, retry_delay: u32) -> Self
pub fn broker_connection_retry_delay(self, retry_delay: u32) -> Self
Set the number of seconds to wait before re-trying the connection with the broker.
Sourcepub fn task_content_type(self, content_type: MessageContentType) -> Self
pub fn task_content_type(self, content_type: MessageContentType) -> Self
Set a default content type of the message body serialization.
Sourcepub fn max_sleep_duration(self, max_sleep_duration: Duration) -> Self
pub fn max_sleep_duration(self, max_sleep_duration: Duration) -> Self
Set a maximum sleep duration, which limits the amount of time that can pass between ticks. This is useful to ensure that the scheduler backend implementation is called regularly.