pub struct FlashQ { /* private fields */ }Expand description
flashQ client with connection pooling.
Implementations§
Source§impl FlashQ
impl FlashQ
Sourcepub fn with_options(opts: ClientOptions) -> Self
pub fn with_options(opts: ClientOptions) -> Self
Create a new client with custom options.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected to the server.
Sourcepub fn pool_stats(&self) -> (u64, u64, usize)
pub fn pool_stats(&self) -> (u64, u64, usize)
Get pool statistics: (reconnects, failures, healthy_connections).
Sourcepub async fn push<T: Serialize>(
&self,
queue: &str,
data: T,
opts: Option<PushOptions>,
) -> Result<u64>
pub async fn push<T: Serialize>( &self, queue: &str, data: T, opts: Option<PushOptions>, ) -> Result<u64>
Push a job to a queue.
Sourcepub async fn push_batch(
&self,
queue: &str,
jobs: Vec<JobPayload>,
) -> Result<BatchPushResult>
pub async fn push_batch( &self, queue: &str, jobs: Vec<JobPayload>, ) -> Result<BatchPushResult>
Push multiple jobs to a queue.
Sourcepub async fn pull(
&self,
queue: &str,
timeout: Option<Duration>,
) -> Result<Option<Job>>
pub async fn pull( &self, queue: &str, timeout: Option<Duration>, ) -> Result<Option<Job>>
Pull a single job from a queue (blocking).
Sourcepub async fn pull_batch(
&self,
queue: &str,
count: u32,
timeout: Option<Duration>,
) -> Result<Vec<Job>>
pub async fn pull_batch( &self, queue: &str, count: u32, timeout: Option<Duration>, ) -> Result<Vec<Job>>
Pull multiple jobs from a queue.
Source§impl FlashQ
Job query and management methods.
impl FlashQ
Job query and management methods.
Sourcepub async fn get_job(&self, job_id: u64) -> Result<Option<JobWithState>>
pub async fn get_job(&self, job_id: u64) -> Result<Option<JobWithState>>
Get a job by ID with its current state.
Sourcepub async fn get_job_by_custom_id(
&self,
custom_id: &str,
) -> Result<Option<JobWithState>>
pub async fn get_job_by_custom_id( &self, custom_id: &str, ) -> Result<Option<JobWithState>>
Get job by custom ID (idempotency lookup).
Sourcepub async fn get_jobs_batch(
&self,
job_ids: Vec<u64>,
) -> Result<Vec<JobWithState>>
pub async fn get_jobs_batch( &self, job_ids: Vec<u64>, ) -> Result<Vec<JobWithState>>
Get multiple jobs by IDs.
Sourcepub async fn get_jobs(
&self,
queue: Option<&str>,
state: Option<JobState>,
limit: Option<u32>,
offset: Option<u32>,
) -> Result<JobsResult>
pub async fn get_jobs( &self, queue: Option<&str>, state: Option<JobState>, limit: Option<u32>, offset: Option<u32>, ) -> Result<JobsResult>
List jobs with filtering and pagination.
Sourcepub async fn get_job_counts(&self, queue: &str) -> Result<JobCounts>
pub async fn get_job_counts(&self, queue: &str) -> Result<JobCounts>
Get job counts by state for a queue.
Sourcepub async fn finished(
&self,
job_id: u64,
timeout: Option<Duration>,
) -> Result<Option<Value>>
pub async fn finished( &self, job_id: u64, timeout: Option<Duration>, ) -> Result<Option<Value>>
Wait for job completion and return result (blocking).
Sourcepub async fn progress(
&self,
job_id: u64,
progress: u8,
message: Option<&str>,
) -> Result<bool>
pub async fn progress( &self, job_id: u64, progress: u8, message: Option<&str>, ) -> Result<bool>
Update job progress (0-100) with optional message.
Sourcepub async fn get_progress(&self, job_id: u64) -> Result<ProgressInfo>
pub async fn get_progress(&self, job_id: u64) -> Result<ProgressInfo>
Get job progress.
Sourcepub async fn update<T: Serialize>(&self, job_id: u64, data: T) -> Result<bool>
pub async fn update<T: Serialize>(&self, job_id: u64, data: T) -> Result<bool>
Update job data.
Sourcepub async fn change_priority(&self, job_id: u64, priority: i32) -> Result<bool>
pub async fn change_priority(&self, job_id: u64, priority: i32) -> Result<bool>
Change job priority.
Sourcepub async fn move_to_delayed(&self, job_id: u64, delay: u64) -> Result<bool>
pub async fn move_to_delayed(&self, job_id: u64, delay: u64) -> Result<bool>
Move active job back to delayed state.
Sourcepub async fn heartbeat(&self, job_id: u64) -> Result<bool>
pub async fn heartbeat(&self, job_id: u64) -> Result<bool>
Send heartbeat for a long-running job.
Sourcepub async fn log(
&self,
job_id: u64,
message: &str,
level: Option<&str>,
) -> Result<bool>
pub async fn log( &self, job_id: u64, message: &str, level: Option<&str>, ) -> Result<bool>
Add a log entry to a job.
Source§impl FlashQ
Queue management, DLQ, rate limiting, cron, flow, and monitoring methods.
impl FlashQ
Queue management, DLQ, rate limiting, cron, flow, and monitoring methods.
Sourcepub async fn drain(&self, queue: &str) -> Result<u64>
pub async fn drain(&self, queue: &str) -> Result<u64>
Drain all waiting jobs from a queue. Returns count of drained jobs.
Sourcepub async fn obliterate(&self, queue: &str) -> Result<bool>
pub async fn obliterate(&self, queue: &str) -> Result<bool>
Remove ALL data for a queue (jobs, DLQ, cron, etc.).
Sourcepub async fn clean(
&self,
queue: &str,
grace: u64,
state: &str,
limit: Option<u32>,
) -> Result<u64>
pub async fn clean( &self, queue: &str, grace: u64, state: &str, limit: Option<u32>, ) -> Result<u64>
Clean jobs older than grace period by state.
Sourcepub async fn list_queues(&self) -> Result<Vec<QueueInfo>>
pub async fn list_queues(&self) -> Result<Vec<QueueInfo>>
List all queues.
Sourcepub async fn get_dlq(&self, queue: &str, count: Option<u32>) -> Result<Vec<Job>>
pub async fn get_dlq(&self, queue: &str, count: Option<u32>) -> Result<Vec<Job>>
Get jobs from the dead letter queue.
Sourcepub async fn retry_dlq(&self, queue: &str, job_id: Option<u64>) -> Result<u64>
pub async fn retry_dlq(&self, queue: &str, job_id: Option<u64>) -> Result<u64>
Retry DLQ jobs. If job_id provided, retries specific job; otherwise retries all.
Sourcepub async fn purge_dlq(&self, queue: &str) -> Result<u64>
pub async fn purge_dlq(&self, queue: &str) -> Result<u64>
Purge all jobs from dead letter queue.
Sourcepub async fn set_rate_limit(&self, queue: &str, limit: u32) -> Result<bool>
pub async fn set_rate_limit(&self, queue: &str, limit: u32) -> Result<bool>
Set rate limit for a queue (jobs per second).
Sourcepub async fn clear_rate_limit(&self, queue: &str) -> Result<bool>
pub async fn clear_rate_limit(&self, queue: &str) -> Result<bool>
Clear rate limit for a queue.
Sourcepub async fn set_concurrency(&self, queue: &str, limit: u32) -> Result<bool>
pub async fn set_concurrency(&self, queue: &str, limit: u32) -> Result<bool>
Set concurrency limit for a queue.
Sourcepub async fn clear_concurrency(&self, queue: &str) -> Result<bool>
pub async fn clear_concurrency(&self, queue: &str) -> Result<bool>
Clear concurrency limit for a queue.
Sourcepub async fn delete_cron(&self, name: &str) -> Result<bool>
pub async fn delete_cron(&self, name: &str) -> Result<bool>
Delete a cron job.
Sourcepub async fn list_crons(&self) -> Result<Vec<CronJob>>
pub async fn list_crons(&self) -> Result<Vec<CronJob>>
List all cron jobs.
Sourcepub async fn push_flow<T: Serialize>(
&self,
queue: &str,
data: T,
children: Vec<FlowChild>,
opts: Option<PushOptions>,
) -> Result<FlowResult>
pub async fn push_flow<T: Serialize>( &self, queue: &str, data: T, children: Vec<FlowChild>, opts: Option<PushOptions>, ) -> Result<FlowResult>
Push a flow (parent job with children dependencies).