Thanks for the response.
I’m using singleton design pattern.
So that every time a post request comes, we can publish, and then subscribe to the topic, but the client remains always connected.
Then I tried to run an a long loop so that I can wait till the message could arrived and for the other side I’m was publishing messages
Continuously but still couldn’t get any message in REST.
I did some research on internet and found I need to build custom listener class for that if Spring is used, which even Andy has written a blog on that.
I’m hope I’m going in a right direction. Andy can suggest on this if we is free and reading this mail
I’m newbie in Spring and Andys application is again JAVA application, I’m trying. I hope I’m working right.
From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx]
On Behalf Of Ian Craggs
Sent: Thursday, March 13, 2014 9:47 PM
Subject: Re: [paho-dev] HTTP - MQTT bridge
you shouldn't need to do anything different for a REST application in particular. You might need to be aware of when client objects are created and destroyed, though.
If a client object is created, connect and subscribes and then is destroyed, if you want it to receive messages for those subscriptions when it is recreated and reconnects, you must:
1) connect non-cleansession (otherwise the subscriptions are deleted on disconnect)
2) make sure the client persistence is turned on and pointing to the same location so that client state is restored when it is recreated
On 03/13/2014 09:47 AM, Bharath C wrote:
I’m developing an HTTP-MQTT bridge.
HTTP/REST side I’m using Jersey rest framework.
My requirement consist publishes a messages and then subscribe to its response.
I’m able a publish a Message using a MQTT client during POST method.
But, I don’t get any messages when its been subscribed. I’m not sure what changes I need to do in perspective to REST.
Since its works fine in normal JAVA application.
Should I use different mqtt clients for pub and sub,
I tried Async client which was working fine in normal java application but in REST it is not working.
Please help me understand if this the MQTT functionality or my ignorance.
Larsen & Toubro Limited
This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
paho-dev mailing list
icraggs@xxxxxxxxxx IBM United Kingdom
Comitter on Paho, Mosquitto