Function spawn_worker_for_queue

Source
pub async fn spawn_worker_for_queue(
    sqs_client: Client,
    queue_type: QueueType,
    queue_url: String,
    app_state: Arc<ThinData<DefaultAppState>>,
    shutdown_rx: Receiver<bool>,
) -> Result<WorkerHandle, QueueBackendError>
Expand description

Spawns a worker task for a specific SQS queue.

The worker continuously polls the queue, processes messages, and handles retries via SQS visibility timeout.

§Arguments

  • sqs_client - AWS SQS client for all operations (poll, send, delete, change visibility)
  • queue_type - Type of queue (determines handler and concurrency)
  • queue_url - SQS queue URL
  • app_state - Application state with repositories and services

§Returns

JoinHandle to the spawned worker task