RPi (Paho MQTT Client) Connect to RabbitMQ Broker (Windows 10) - rabbitmq-mqtt plugin enabled

195 views
Skip to first unread message

Jade de la Pena

unread,
Apr 26, 2020, 5:14:28 AM4/26/20
to rabbitmq-users
Hello,

I wanted to have my Raspberry Pi to connect and publish MQTT messages to my RabbitMQ Server running on my Windows 10 machine.

First, I enabled the rabbitmq_mqtt plugin by running "rabbitmq-plugins enable rabbitmq_mqtt"

Second, as what this post suggested, I created a new user for MQTT connections with full access to the default virtual host used by this plugin.

rabbitmqctl add_user mqtt-test mqtt-test
rabbitmqctl set_permissions -p / mqtt-test ".*" ".*" ".*"
rabbitmqctl set_user_tags mqtt-test management

I understand that RabbitMQ has an anonymous MQTT user feature, but I do not want to implement this for now.

Attached in here is my python script. It runs the Paho Python MQTT client.
When I try to run my python script, it does not do anything until a timeout error occurs.

How will I have my Raspberry Pi MQTT Client be able to connect and publish messages to my RabbitMQ Server?

Thank you.


sample_connection_client.py

Luke Bakken

unread,
Apr 26, 2020, 9:53:59 AM4/26/20
to rabbitmq-users
Hello,

Attached in here is my python script. It runs the Paho Python MQTT client.
When I try to run my python script, it does not do anything until a timeout error occurs.

What is the exact error your application returns?

Are you certain that the MQTT port is open? https://www.rabbitmq.com/troubleshooting-networking.html

Thanks -
Luke 

Jade de la Pena

unread,
Apr 26, 2020, 10:57:53 AM4/26/20
to rabbitmq-users
Hi, after running "rabbitmq-diagnostics listeners", this is the result:

Asking node rabbit@DESKTOP-ESRQP0K to report its protocol listeners ...
Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: 0.0.0.0, port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
Interface: 0.0.0.0, port: 15672, protocol: http, purpose: HTTP API
Interface: [::], port: 1883, protocol: mqtt, purpose: MQTT
Interface: 0.0.0.0, port: 1883, protocol: mqtt, purpose: MQTT

I assume this means that the MQTT port is open. Is that true?

Also, is there any missing component in my Python script?

Luke Bakken

unread,
Apr 26, 2020, 1:58:24 PM4/26/20
to rabbitmq-users
Hello,

Please answer the question that I asked - What is the exact error your application returns?

Also, please read the document to which I linked. There is more to troubleshoot. The command output you show indicates that RabbitMQ is listening on the MQTT port, but the Windows firewall is probably blocking it. That is my guess.

Thanks -
Luke

Jade de la Pena

unread,
Apr 27, 2020, 3:29:19 AM4/27/20
to rabbitmq-users
Hello Luke,

Thank you. It was the Window's Firewall that was blocking the communication port. It works fine now.
Reply all
Reply to author
Forward
0 new messages