RabbitMQ Bridge

    After EMQX version 3.1, a powerful rule engine is introduced to replace plug-ins. It is recommended that you use it. See Bridge data to RabbitMQ to setup RabbitMQ bridges in rule engine.

    Configure RabbitMQ Bridge Hooks

    1. bridge.rabbit.hook.client.subscribe.1 = {"action": "on_client_subscribe", "rabbit": 1, "exchange": "direct:emq.subscription"}
    2. bridge.rabbit.hook.client.unsubscribe.1 = {"action": "on_client_unsubscribe", "rabbit": 1, "exchange": "direct:emq.unsubscription"}
    3. bridge.rabbit.hook.message.publish.1 = {"topic": "$SYS/#", "action": "on_message_publish", "rabbit": 1, "exchange": "topic:emq.$sys"}
    4. bridge.rabbit.hook.message.publish.2 = {"topic": "#", "action": "on_message_publish", "rabbit": 1, "exchange": "topic:emq.pub"}

    Forward Unsubscription Event to RabbitMQ

    1. routing_key = unsubscribe
    2. exchange = emq.unsubscription
    3. payload = jsx:encode([Topic || {Topic, _Opts} <- TopicTable]),

    Forward MQTT Message Ack Event to RabbitMQ

    1. routing_key = puback
    2. exchange = emq.acked
    3. headers = [{<<"x-emq-msg-acked">>, binary, ClientId}],
    4. payload = emqx_base62:encode(Id)

    Sample code of Rabbit message Consumption in Python:

    https://github.com/rabbitmq/rabbitmq-tutorialsRabbitMQ Bridge - 图2 (opens new window)

    Enable RabbitMQ Bridge