Skip to content

Publishing

MQBroker uses the same publish API as the other brokers.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from faststream_mq import MQBroker

broker = MQBroker(queue_manager="QM1")


async def publish() -> None:
    async with broker:
        await broker.publish(
            {"message": "hello"},
            queue="orders.incoming",
            headers={"source": "docs"},
        )

Important IBM MQ specifics

  • the destination is always a queue name
  • message_id and correlation_id use MQ-native 48-character hex values when explicitly provided
  • custom headers are stored as MQ user properties