Struct sqlxmq::JobRunnerOptions
source · pub struct JobRunnerOptions { /* private fields */ }
Expand description
Type used to build a job runner.
Implementations§
source§impl JobRunnerOptions
impl JobRunnerOptions
sourcepub fn new<F: Fn(CurrentJob) + Send + Sync + 'static>(
pool: &Pool<Postgres>,
f: F
) -> Self
pub fn new<F: Fn(CurrentJob) + Send + Sync + 'static>( pool: &Pool<Postgres>, f: F ) -> Self
Begin constructing a new job runner using the specified connection pool, and the provided execution function.
sourcepub fn set_concurrency(
&mut self,
min_concurrency: usize,
max_concurrency: usize
) -> &mut Self
pub fn set_concurrency( &mut self, min_concurrency: usize, max_concurrency: usize ) -> &mut Self
Set the concurrency limits for this job runner. When the number of active jobs falls below the minimum, the runner will poll for more, up to the maximum.
The difference between the min and max will dictate the maximum batch size which can be received: larger batch sizes are more efficient.
sourcepub fn set_channel_names<'a>(
&'a mut self,
channel_names: &[&str]
) -> &'a mut Self
pub fn set_channel_names<'a>( &'a mut self, channel_names: &[&str] ) -> &'a mut Self
Set the channel names which this job runner will subscribe to. If unspecified, the job runner will subscribe to all channels.
sourcepub fn set_keep_alive(&mut self, keep_alive: bool) -> &mut Self
pub fn set_keep_alive(&mut self, keep_alive: bool) -> &mut Self
Choose whether to automatically keep jobs alive whilst they’re still
running. Defaults to true
.
sourcepub async fn run(&self) -> Result<JobRunnerHandle, Error>
pub async fn run(&self) -> Result<JobRunnerHandle, Error>
Start the job runner in the background. The job runner will stop when the returned handle is dropped.
Trait Implementations§
source§impl Clone for JobRunnerOptions
impl Clone for JobRunnerOptions
source§fn clone(&self) -> JobRunnerOptions
fn clone(&self) -> JobRunnerOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more