Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Delay in receiving subscribed message

Hi Manoj,

Like Nick suggests, your delay means that the loop() call is also
delayed. I'd actually recommend using either loop_start() or
loop_forever() in most applications, depending on what the rest of
your application does.

So:

mqttc.subscribe('mqtt-subscription-client123qos1',1)
mqttc.on_message = on_message

mqttc.loop_start()

while True:
    msg = 13

    mqttc.publish("request", msg , qos=1, retain=False) # qos = 0,
    print "Message Published"
    time.sleep(1)

Cheers,

Roger


On Sun, Jul 6, 2014 at 8:09 AM, Manoj Gudi <manoj.p.gudi@xxxxxxxxx> wrote:
> Hello,
>
> I am trying to implement a simple RPC like communication using RabbitMQ
> server and a MQTT client; the client sends a number to a (request) queue of
> the server, server processes the number taken from queue and sends it to
> (response) queue to which client is subscribed.
>
> I am encountering this weird behavior from Paho MQTT client using Rabbitmq's
> mqtt plugin with pika driver for Server and paho-mqtt for client.
>
>
> RabbitMQ server source
> http://pastebin.com/51dGjHXb
>
> client source
> http://pastebin.com/P193iMLh
>
> the client publishes exactly 3 times before it starts receiving the
> message(response of first message sent by client) from subscribed topic
> (rabbitmq queue), and afterwards follows one request <--> one response
> pattern with offset of 3.
>
> The output for client is like this:
> Message Published
> Message Published
> Message Published
> what's payload:  6227020800   (Answer of First message)
> Message Published
> what's payload:  6227020800   (Answer of Second message)
> Message Published
> what's payload:  6227020800   (Answer of Third message)
> .....
>
> I have tried changing the time-out and the sleep duration but with no
> effect.
>
> I tried to check queue of rabbitmq to ascertain if it was misbehaving, but
> its not. Rabbitmq updates the queue(to which client is subscribed) with
> response as soon as it receives the message from client.
>
> I know I can use Mosquitto server instead of RabbitMQ. but I want the broker
> to scale really well without much effort..
>
> Any help/guidance would be appreciated.
>
> platform details:
> Ubuntu 12.04
> paho-mqtt==0.9.1
> pika==0.9.13
> rabbitmq-server 3.2.4
>
> PS: I hope I'm posting in the right mailing list, if not, kindly let me
> know.
>
> Thanks,
> Manoj
>
> _______________________________________________
> paho-dev mailing list
> paho-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top