tchaloupka / vibe-mqtt

MQTT client for D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code crush on no_ack=True

bubnenkoff opened this issue · comments

I am learning mqtt. I wrote next consumer (from RabbitMQ examples):

import pika
conn = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
chan = conn.channel()

def callback(ch, method, propeties, body):
	print("I got: ", body)

chan.basic_consume(callback, queue='test', no_ack=True)
chan.start_consuming()

I am noob in MQ. So I simply change default port in D example to: settings.port = 5672;. When I am running publisher I am getting error: main(lbbt) WRN] MQTT ConAck not received, disconnecting. What I am doing wrong? The port number incorrect? Problem in no_ack=True or what?

From what I guess this is probably just that you set the port to the AMQP endpoint of the RabbitMQ, which is RabbitMQ main protocol.
For MQTT to work with Rabbit, you'll have to install this plugin for it: https://www.rabbitmq.com/mqtt.html
Then you will be able to communicate with it using MQTT protocol on the standard port.
Be careful when you want to use QoS2 messages, because the RabbitMQ MQTT plugin doesn't support that. So if you don't rely on RabbitMQ features and can use MQTT only, then Mosquitto (https://mosquitto.org/) might be the better broker (and also a lot faster).

But I thought that RabbitMQ use AMQP protocol? Or am I wrong?

Here is the documentation page of the supported protocols: https://www.rabbitmq.com/protocols.html

Which of them is used by default? I just want to run simple example.
If I right understand default is AMQP ?

Yes as I wrote, the default is AMQP. As of now I don't know of any library for D to communicate with it. MQTT is much simpler protocol and for that to work with RabbitMQ you need to install mentioned plugin first. Or use other MQTT only broker if possible (like mentioned Mosqitto)

Thanks!