Configuration
The core is a codec, so there’s almost nothing to configure — the “wiring” is your own broker client plus a couple of optional behaviours.
Envelope options
Make accepts functional options. Set the queue name (written to meta.queue)
and continue an inbound trace across a hop:
env, _ := babelqueue.Make(
"urn:babel:orders:created",
map[string]any{"order_id": 1042},
babelqueue.WithQueue("orders"),
babelqueue.WithTraceID(inbound.TraceID), // omit to mint a fresh trace_id
)
Dead-letter
On failure, wrap the envelope in an additive dead_letter block and publish the
copy to your dead-letter queue (e.g. orders.dlq):
dl := babelqueue.Annotate(env, "failed", "orders", 3, err)
body, _ := dl.Encode()
// publish body to the "orders.dlq" queue with your broker client
Annotate returns a copy — the original envelope is preserved unchanged inside
the dead-lettered message, so any-language consumer can still read it.
Unknown-URN strategy
For adapters routing inbound messages, the strategy constants StrategyFail,
StrategyDelete, StrategyRelease and StrategyDeadLetter describe what to do
with a URN you don’t handle.
Next: Producing messages.