我正在尝试将 MQTT 连接器连接到我的代理。 代理正在监听 ws://localhost:1234
我使用 Quarkus 作为我的后端框架。我的 MQTT 连接器的配置设置为:
# Outcoming MQTT configuration
mp.messaging.outgoing.mqtt/test.connector=smallrye-mqtt
mp.messaging.outgoing.mqtt/test.host=localhost
mp.messaging.outgoing.mqtt/test.port=1234
mp.messaging.outgoing.mqtt/test.qos=1
mp.messaging.outgoing.mqtt/test.protocol=ws
我的 Quarkus 应用程序成功启动后,会显示以下消息:
> :se2024-07-18 07:57:29,676 INFO [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection with localhost:4456 established successfully
2024-07-18 07:57:29,678 INFO [io.sma.rea.mes.mqt.ses.imp.MqttClientSessionImpl] (vert.x-eventloop-thread-0) Connection closed: <unknown>
> :se2024-07-18 07:57:30,682 INFO [io.ver.mqt.imp.MqttClientImpl] (vert.x-eventloop-thread-0) Connection with localhost:4456 established successfully
2024-07-18 07:57:30,683 INFO [io.sma.rea.mes.mqt.ses.imp.MqttClientSessionImpl] (vert.x-eventloop-thread-0) Connection closed: <unknown>
此信息会不断打印,直到应用程序终止。对我在这里做错了什么有什么建议吗?
客户端不支持基于WebSocket的MQTT。所以
protocol
属性没有任何效果。您需要将主机/端口配置为监听mqtt协议的broker端口。通常是localhost:1883
。