Hello team,
I am trying to use paho for publishing via mqtt protocol to Rabbitmq topic and the exchange has routing key to one queue.
everything is fine till the topic, but i dont see the messages.
can you tell me what i am missing.
here is the python script:
import paho.mqtt.client as paho
import time
mqtthost = "localhost"
mqttuser = "user"
mqttpass = "pass"
mqtttopic = "amq.topic" - also tried "amq.topic/some routing key"
def on_connect(client, userdata, flags, rc):
print("CONNACK received with code %d." % (rc))
def on_publish(client, userdata, mid):
print("mid: "+str(mid))
client = paho.Client()
client.on_connect = on_connect
client.on_publish = on_publish
client.username_pw_set(mqttuser,mqttpass)
client.connect(mqtthost, 1883,60)
client.loop_start()
while True:
temperature = "test data"
(rc, mid) = client.publish(mqtttopic, str(temperature), qos=1)
time.sleep(10)
exchange is amq.topic and i have added routing key for some local queue.
i see that there are Publish (IN) on this topic but queue is empty. If i publish manually via web one message, it goes to the queue. the question is from command line..
thanks.