--- title: "Producing messages" description: "Producing messages — Python BabelQueue SDK (1.x)." source: https://babelqueue.com/docs/babelqueue-python/1.x/producing-messages/ updated: 2026-06-06T00:00:00.000Z --- # Producing messages ## With the runtime Publish a message with its URN and payload. The `BabelQueue` runtime builds the canonical envelope and pushes it to your broker: ```python from babelqueue import BabelQueue app = BabelQueue("redis://localhost:6379/0", queue="orders") app.publish("urn:babel:orders:created", { "order_id": 1042, "amount": 99.90, }) ``` ## With the codec only If you manage the broker connection yourself, build the envelope with `EnvelopeCodec` and publish the JSON to your own client: ```python from babelqueue import EnvelopeCodec env = EnvelopeCodec.make("urn:babel:orders:created", {"order_id": 1042, "amount": 99.90}) body = EnvelopeCodec.encode(env) # -> UTF-8 JSON string # redis.rpush("queues:orders", body) # / channel.basic_publish(body=body, ...) ``` The payload above is wrapped in the canonical `schema_version: 1` envelope — identical to what every other SDK emits, with `meta.lang` set to `"python"`: ```json { "job": "urn:babel:orders:created", "trace_id": "7b3f9c2a-e41d-4f88-9b2a-1c0d5e6f7a8b", "data": { "order_id": 1042, "amount": 99.90 }, "meta": { "id": "f1e2d3c4-b5a6-4789-90ab-cdef01234567", "queue": "orders", "lang": "python", "schema_version": 1, "created_at": 1749132727000 }, "attempts": 0 } ``` Next: [Consuming messages](/docs/babelqueue-python/1.x/consuming-messages/).