Queue Module
The Queue module provides a robust background job processing system with priority queues, backpressure management, dead letter queues, and configurable retry strategies. It integrates with Redis, RabbitMQ, and in-process workers.
Configuration
example.py
python
Copied!
Defining Jobs
send_email.py
python
Copied!
Enqueuing Jobs
create_user.py
python
Copied!
Priority Levels
| Priority | Value | Use Case |
|---|---|---|
CRITICAL | 1 | Payment processing, security alerts |
HIGH | 3 | User-facing notifications, time-sensitive tasks |
NORMAL | 5 | Default priority, standard processing |
LOW | 7 | Analytics, data synchronization |
BATCH | 10 | Report generation, bulk imports |
Backpressure Management
When the queue reaches capacity, Vorte applies a backpressure strategy to prevent system overload.
| Strategy | Behavior |
|---|---|
reject | Reject new jobs and return an error to the caller |
delay | Delay accepting new jobs until capacity is available |
drop_oldest | Drop the lowest-priority queued job to make room |
scale | Automatically scale worker count up to a configured maximum |
Dead Letter Queue
Jobs that exceed their retry limit are moved to the dead letter queue (DLQ) for inspection and manual replay.
example.py
python
Copied!
Retry Logic
fetch_external_api.py
python
Copied!
| Backoff Strategy | Delay Calculation |
|---|---|
constant | Always base_delay |
linear | base_delay * retry_number |
exponential | base_delay * 2^retry_number |
Scheduled Jobs
cleanup_expired_sessions.py
python
Copied!
Job Monitoring
example.py
python
Copied!