将rabbitmq web mqtt插件绑定到javascript接口

1yjd4xko  于 2023-10-20  发布在  RabbitMQ
关注(0)|答案(1)|浏览(162)

如何将rabbitmq web mqtt插件绑定到xml5接口?
我正在尝试使用配置文件/etc/rabbitmq/rabbitmq.conf

listeners.tcp.1 = 127.0.0.1:5672
management.listener.ip = 127.0.0.1
management.listener.port = 15672
mqtt.listeners.tcp.1 = 127.0.0.1:1883

web_mqtt.tcp.ip=127.0.0.1
web_mqtt.tcp.port=15675

虽然配置可以正常工作,

AMQP (5672)
Management (15672) and 
mqtt (1883)

它对web_mqtt(15675)失败。

$ journalctl -xe
{{shutdown,{failed_to_start_child,ranch_acceptors_sup,badarg}},
{child,undefined, {ranch_listener_sup,web_mqtt},
{ranch_listener_sup,start_link, [web_mqtt,10,ranch_tcp, [{connection_type,supervisor},{ip,"127.0.0.1"},{port,15675}],
rabbit_web_mqtt_connection_sup, Mar 20 16:32:07 visiongui rabbitmq-server[9069]:                   #{env =>
#{dispatch =>
{'_',[],
[{[<<"ws">>],[],rabbit_web_mqtt_handler,[]}]}]},
middlewares =>
[cowboy_router,rabbit_web_mqtt_middleware, cowboy_handler]}]},
permanent,infinity,supervisor,
[ranch_listener_sup]}}}},
[{rabbit_web_mqtt_app,mqtt_init,0,
[{file,"src/rabbit_web_mqtt_app.erl"},{line,65}]},
{rabbit_web_mqtt_app,start,2,
[{file,"src/rabbit_web_mqtt_app.erl"},{line,31}]},
{application_master,start_it_old,4,
 [{file,"application_master.erl"},{line,273}]}]}}}}}}
Log file(s) (may contain more information):
/var/log/rabbitmq/[email protected]
 /var/log/rabbitmq/rabbit@visiongui_upgrade.log
{"init terminating in do_boot",{could_not_start,rabbitmq_web_mqtt,{rabbitmq_web_mqtt,{bad_return,{{rabbit_web_mqtt_app,start,[normal,[]]},{'EXIT',{{badmatc
init terminating in do_boot ({could_not_start,rabbitmq_web_mqtt,{rabbitmq_web_mqtt,{bad_return,{{_},{_}}}}})
a0zr77ik

a0zr77ik1#

在如何将web_mqtt设置转换为Erlang术语方面似乎存在一个错误。我已经提交了一个问题here,如果你想跟着沿着。
同时,我建议在您的环境中使用/etc/rabbitmq/rabbitmq.conf/etc/rabbitmq/advanced.config文件的组合。
rabbitmq.conf应该包含以下内容:

listeners.tcp.1 = 127.0.0.1:5672
management.listener.ip = 127.0.0.1
management.listener.port = 15672
mqtt.listeners.tcp.1 = 127.0.0.1:1883

/etc/rabbitmq/advanced.config应该包含以下内容:

[
    {rabbitmq_web_mqtt, [
        {tcp_config, [
            {ip, {127,0,0,1}},
            {port, 15675}
        ]}
    ]}
].

请让我知道这是否解决了你的问题。

相关问题