mqttquarkusmessagebrokerbrokersmallrye-reactive-messaging

Cannot connect to MQTT broker via SmallRye Reactive Messanging MQTT connector in Quarkus


I am trying to connect MQTT connector to my broker. Broker is listening on ws://localhost:1234

I am using a Quarkus as my backend framework. The configuration for my MQTT connector is set as:

# 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

After my Quarkus application is successfully started, the following messages are displayed:

> :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>

This is constantly printed, until application is terminated. Any advice on what I am doing wrong here?


Solution

  • The client doesn't support MQTT over WebSocket. So the protocol attribute doesn't have any effect. You need to configure the host/port to the broker port listening to the mqtt protocol. It is typically localhost:1883.