Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Subscribing to topic

Hi Said,

how you like to structure you application is up to you and not an MQTT thing. I just tested your use case and for me it is working just fine.. The attached Java code should give you an idea how the MQTT client works. 

Sandro

Attachment: mqtt.java
Description: Binary data


> Am 07.12.2015 um 16:35 schrieb Said Uçar <said.ucar@xxxxxxxxxxx>:
> 
> Hi Sandro,
> 
> I'm so sorry, I'm using Java. The story is, I subscribe a topic (name = "register") at the application startup. Interestingly I can subscribe to topic. Then, I publish message to this topic (register) from another Java app to register. My onMessageArrived method takes this mesage perfectly. My purpose is, I want to subscribe new topic in here. The aim is, when I add new device to field, it publish its id to "register" topic, and the main app subscribe this new devices own topic. After that, every device on the field publish data to their own topic. I hope it is more clear now. 
> I tried to subscribe multiple topic, it works.
> I checked isConnected(), it is connected to broker.
> I can publish message the line before that I can^t subscribe. 
> 
> I think I shouldn't invoke subscribe() method in onMessageArrived() method or something else?
> 
> Thanks again,
> Said.
> 
> -----Original Message-----
> From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] On Behalf Of Sandro Kock
> Sent: Monday, December 7, 2015 5:24 PM
> To: General development discussions for paho project <paho-dev@xxxxxxxxxxx>
> Subject: Re: [paho-dev] Subscribing to topic
> 
> Hi Said,
> 
> what programming language are you using? Paho offers MQTT implementations in many different languages.
> You have to provide more information on how you are using there library so that we can help you. Posting you code somewhere helps too.
> 
> Sandro
>> Am 07.12.2015 um 16:21 schrieb Said Uçar <said.ucar@xxxxxxxxxxx>:
>> 
>> Hi,
>> 
>> I'm trying to subscribe a topic but it isn't happen. I debug my code, 
>> into the subscribe method, it goes Object class wait() method and wait 
>> here forever. The timeout variables value is "-1 ".  Any idea on that? 
>> I checked that my MqttClient object is connected, I can publish 
>> message, but I can't subscribe. If you wish, I can try to explain more detail.
>> 
>> Thanks in advance,
>> Said.
>> 
>> _______________________________________________
>> 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
> 
> _______________________________________________
> 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
> 
> _______________________________________________
> 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