Configuration
Create a BabelQueue runtime and point it at your broker with a URL. The
transport is chosen from the URL scheme — no separate “broker” flag.
Broker URL
from babelqueue import BabelQueue
# Redis (extra: babelqueue[redis])
app = BabelQueue("redis://localhost:6379/0", queue="orders")
# RabbitMQ (extra: babelqueue[amqp])
# app = BabelQueue("amqp://guest:guest@localhost:5672/", queue="orders")
# Amazon SQS (extra: babelqueue[sqs])
# app = BabelQueue("sqs://eu-central-1", queue="orders")
# Azure Service Bus (extra: babelqueue[azureservicebus])
# app = BabelQueue("sb://<namespace>.servicebus.windows.net", queue="orders")
# Apache Pulsar (extra: babelqueue[pulsar])
# app = BabelQueue("pulsar://localhost:6650", queue="orders")
# In-process, great for tests/local — no broker required
# app = BabelQueue("memory://", queue="orders")
| Scheme | Transport | Requires |
|---|---|---|
memory:// | In-process (tests / local) | built in |
redis:// | Redis (reliable-queue pattern) | babelqueue[redis] |
amqp:// | RabbitMQ (via pika) | babelqueue[amqp] |
sqs:// | Amazon SQS (via boto3) | babelqueue[sqs] |
sb:// | Azure Service Bus (via azure-servicebus) | babelqueue[azureservicebus] |
pulsar:// | Apache Pulsar (via pulsar-client) | babelqueue[pulsar] |
The sqs:// URL is sqs://<region> with optional query params: endpoint
(LocalStack/ElasticMQ), prefix (a queue-URL prefix that skips GetQueueUrl), fifo=1,
group_id, wait_time. The transport sends the canonical envelope with the
§3 MessageAttributes and reconciles
attempts to ApproximateReceiveCount − 1.
The sb:// URL is sb://<namespace>.servicebus.windows.net and authenticates with
DefaultAzureCredential (Azure AD); pass connection_string=... to AsbTransport for
SAS auth, or BabelQueue(transport=...) with a built client. It maps the envelope onto
native Service Bus fields (§4) and
reconciles attempts to max(body, DeliveryCount − 1).
The pulsar:// URL is pulsar://<host>:<port> (or pulsar+ssl://); pass a built client
via BabelQueue(transport=...) for TLS/token auth. It projects the envelope onto native
Pulsar message properties (bq-job = URN, plus the bq- fields,
§5), defaults to a Shared subscription
named babelqueue, and reconciles attempts to max(body, redelivery_count) — the
redelivery count is 0-based, so no −1.
Options
| Option | Default | Description |
|---|---|---|
queue | default | Queue name written to meta.queue |
max_attempts | — | Retries before a message is exhausted (bumps attempts) |
dead_letter | False | Quarantine exhausted messages on <queue>.dlq |
on_unknown_urn | fail | fail | delete | release | dead_letter |
app = BabelQueue(
"redis://localhost:6379/0",
queue="orders",
max_attempts=3,
dead_letter=True,
on_unknown_urn="dead_letter",
)
Need just the wire codec, with no broker wiring? Import
EnvelopeCodecdirectly — see Producing messages.
Next: Producing messages.