Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] HTTP - MQTT bridge

Hi Adam,

 

Flow is like this:

 

1. client sends an POST request to jersey application.

2. Jersey application calls an singleton MQTT client and publishes data on an given topic.

3. Once the message is published. MQTT client subscribes to an topic, which acts as an response to the published message.

4. Here I’m facing problem but I’m not getting subscribed messages

 

 

My questions are:

1. does mqtt works without any problems in an webserver environment.

Since I was able to publishes messages, but not able to received subscribed messages.

 

I came across this link which describes this thing by having custom adapter

http://andypiper.co.uk/2014/02/14/spring-integration-mqtt/ // done in spring.

 

 

Pls let me know ur ideas on it.

 

-Bharath.

 

From: ahelblin@xxxxxxxxx [mailto:ahelblin@xxxxxxxxx] On Behalf Of Adam H
Sent: Monday, March 17, 2014 6:30 PM
To: General development discussions for paho project
Cc: Bharath C
Subject: Re: [paho-dev] HTTP - MQTT bridge

 

Bharath,

 

I am by no means an MQTT expert, but may be able to provide some insight. However, I don't totally understand what you're trying to do. The thing that confuses me the most about your question is that you state "the client remains always connected". This is inherently, how MQTT works. If you could show us a quick flow diagram of what you're trying to accomplish it may be easier to help.

 

Best of luck 

 

On Mon, Mar 17, 2014 at 5:04 AM, Bharath C <Bharath.C@xxxxxxxxxx> wrote:

Pls help me regarding  this.

 

-Bharath

 

From: Bharath C
Sent: Friday, March 14, 2014 9:34 AM
To: paho-dev@xxxxxxxxxxx
Subject: RE: [paho-dev] HTTP - MQTT bridge

 

Hi Ian,

 

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.

http://andypiper.co.uk/2014/02/14/spring-integration-mqtt/

 

I’m hope I’m going in a right direction. Andy can suggest on this if we is free and reading this mail J

 

I’m newbie in Spring and Andys application is again JAVA application, I’m trying. I hope I’m working right.

 

Regards,

Bharath.

 

 

From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] On Behalf Of Ian Craggs
Sent: Thursday, March 13, 2014 9:47 PM
To: paho-dev@xxxxxxxxxxx
Subject: Re: [paho-dev] HTTP - MQTT bridge

 

Hi Bharath,



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

Ian

On 03/13/2014 09:47 AM, Bharath C wrote:

Hi All,

 

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.

 

Regards,

Bharath.

 

Larsen & Toubro Limited

www.larsentoubro.com

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
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev

 

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Comitter on Paho, Mosquitto
 

Larsen & Toubro Limited

www.larsentoubro.com

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
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev

 

Larsen & Toubro Limited

www.larsentoubro.com

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.


Back to the top