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

EnvelopeCodec.make takes options for the queue name (written to meta.queue) and trace continuation across a hop:

import { EnvelopeCodec } from "@babelqueue/core";

const env = EnvelopeCodec.make(
  "urn:babel:orders:created",
  { order_id: 1042 },
  { queue: "orders", traceId: inbound.trace_id }, // omit traceId to mint a fresh one
);

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):

import { annotate, EnvelopeCodec } from "@babelqueue/core";

const dlq = annotate(env, "failed", "orders", { attempts: 3, error: "boom" });
// publish EnvelopeCodec.encode(dlq) to the "orders.dlq" queue

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, UnknownUrnStrategy (FAIL, DELETE, RELEASE, DEAD_LETTER) describes what to do with a URN you don’t handle.

Next: Producing messages.