pub trait QueueBackend: Send + Sync {
// Required methods
fn produce_transaction_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn produce_transaction_submission<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn produce_transaction_status_check<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionStatusCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn produce_notification<'life0, 'async_trait>(
&'life0 self,
job: Job<NotificationSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn produce_token_swap_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TokenSwapRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn produce_relayer_health_check<'life0, 'async_trait>(
&'life0 self,
job: Job<RelayerHealthCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn initialize_workers<'life0, 'async_trait>(
&'life0 self,
app_state: Arc<ThinData<DefaultAppState>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkerHandle>, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueHealth>, QueueBackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn backend_type(&self) -> QueueBackendType;
// Provided method
fn shutdown(&self) { ... }
}Expand description
Queue backend abstraction trait.
This trait defines the interface for job queue operations that can be implemented by different backends (Redis/Apalis, AWS SQS, etc.).
The trait is designed to be backend-agnostic, with no Redis or SQS-specific types in the interface.
Required Methods§
Sourcefn produce_transaction_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_transaction_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn produce_transaction_submission<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_transaction_submission<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Produces a transaction submission job to the queue.
Sourcefn produce_transaction_status_check<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionStatusCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_transaction_status_check<'life0, 'async_trait>(
&'life0 self,
job: Job<TransactionStatusCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Produces a transaction status check job to the queue.
Sourcefn produce_notification<'life0, 'async_trait>(
&'life0 self,
job: Job<NotificationSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_notification<'life0, 'async_trait>(
&'life0 self,
job: Job<NotificationSend>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Produces a notification send job to the queue.
Sourcefn produce_token_swap_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TokenSwapRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_token_swap_request<'life0, 'async_trait>(
&'life0 self,
job: Job<TokenSwapRequest>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Produces a token swap request job to the queue.
Sourcefn produce_relayer_health_check<'life0, 'async_trait>(
&'life0 self,
job: Job<RelayerHealthCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn produce_relayer_health_check<'life0, 'async_trait>(
&'life0 self,
job: Job<RelayerHealthCheck>,
scheduled_on: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<String, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Produces a relayer health check job to the queue.
Sourcefn initialize_workers<'life0, 'async_trait>(
&'life0 self,
app_state: Arc<ThinData<DefaultAppState>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkerHandle>, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize_workers<'life0, 'async_trait>(
&'life0 self,
app_state: Arc<ThinData<DefaultAppState>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<WorkerHandle>, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initializes and starts all worker tasks for this backend.
Workers will poll their respective queues and process jobs using the provided application state.
§Arguments
app_state- Application state containing handlers and configuration
§Returns
Vector of worker handles that can be used to monitor or stop workers
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueHealth>, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<QueueHealth>, QueueBackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Performs a health check on all queues.
Returns health status for each queue, including message counts and backend-specific health indicators.
Sourcefn backend_type(&self) -> QueueBackendType
fn backend_type(&self) -> QueueBackendType
Returns the backend type identifier.