# emqx_plugin_rabbitmq **Repository Path**: igit-cn/emqx_plugin_rabbitmq ## Basic Information - **Project Name**: emqx_plugin_rabbitmq - **Description**: RabbitMQ Plugin For EMQX v5 - **Primary Language**: Erlang - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-30 - **Last Updated**: 2025-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # emqx_plugin_rabbitmq RabbitMQ Plugin for EMQX >= V5.4.0 && EMQX <= V5.6.1 ## Usage ### Release ```shell > git clone https://github.com/igit-cn/emqx_plugin_rabbitmq.git > cd emqx_plugin_rabbitmq > make rel _build/default/emqx_plugrel/emqx_plugin_rabbitmq-.tar.gz ``` ### Config #### Explain ```shell > cat priv/emqx_plugin_rabbitmq.hocon plugin_rabbitmq { // RabbitMQ 连接配置 connection { // RabbitMQ 服务器地址列表,例如 "127.0.0.1:5672" hosts = "127.0.0.1:5672" // RabbitMQ 用户名 username = "admin" // RabbitMQ 密码 password = "rabbitmq" // RabbitMQ 虚拟主机 virtual_host = "/" // 连接超时时间 (毫秒) heartbeat = 60 // 其他 amqp_client 连接参数可以按需添加 // 例如: channel_max, frame_max, ssl_options 等 } // 生产者/发布者配置 (如果需要特定的池或缓冲设置) // 注意: RabbitMQ 的 amqp_client 通常在每个进程中管理自己的通道 // 因此这里的配置可能更多的是关于消息发布时的选项 producer { // 默认交换机名称,如果 topic 中未指定 default_exchange = "" // 默认交换机类型 (direct, topic, fanout, headers) default_exchange_type = "fanout" // 默认路由键,如果 topic 中未指定 default_routing_key = "emqx_message" // 消息持久化 (true/false) persistent_messages = true // 其他发布参数,例如: mandatory, immediate (AMQP 0-9-1) } // 主题到 RabbitMQ 交换机和路由键的映射配置列表 topics = [ { // MQTT 主题过滤器 filter = "/edge/test1/#" // RabbitMQ 交换机名称 exchange = "test1_exchange" // 明确指定交换机类型与RabbitMQ实际类型一致 exchange_type = "fanout" // 路由键建议设置为空或#,适配fanout交换机特性 routing_key = "" // 显式指定消息模板为JSON格式,确保数据可读性 rabbitmq_message = "${.}" }, { filter = "/edge/test2/#" exchange = "test2_exchange" exchange_type = "fanout" routing_key = "" //rabbitmq_message = "{\"topic\":\"${topic}\",\"payload\":\"${payload}\",\"timestamp\":${timestamp}}" rabbitmq_message = "${.}" } ] } ``` #### Path - Default path: `emqx/etc/emqx_plugin_rabbitmq.hocon` #### Reload ```shell // emqx_ctl > bin/emqx_ctl emqx_plugin_rabbitmq emqx_plugin_rabbitmq reload # Reload topics > bin/emqx_ctl emqx_plugin_rabbitmq reload topics configuration reload complete. ```