Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » MQTT C++ Embedded for Linux - Subscribe Messages Not Showing Up until Unsubscribe(Subscriber messages are not captured unless Repeated Publish by Client)
MQTT C++ Embedded for Linux - Subscribe Messages Not Showing Up until Unsubscribe [message #1827540] Mon, 18 May 2020 02:43 Go to next message
Jim Rhodes is currently offline Jim RhodesFriend
Messages: 4
Registered: May 2020
Junior Member
Hi,

I have MQTT running on my BeagleBone AI board under Linux, and all is correct it seems, except that after I subscribe to a topic, and publish the first time, messages are not handled in the messageArrived handler until I perform an unsubscribe, and then ALL of the messages are then handled by. void messageArrived(MQTT::MessageData& md).

I used the "example" linux.cpp routines in the C++ code set, and really it has been flawless, I can publish and see my embedded side publish messages show up in my other client no problem, but the ones that I am subscribing to (I am also subscribing to them as well for debug) in the embedded side are queued up and not handled until I shutdown my program elegantly, in which one step is to unsubscribe from the topic, and bam, they all pop out.

I have checked the messsagehandler registration, timers seem to be running, I am calling
// let MQTT pass us messages if they are there
if(arrivedcount == 0)
client.yield(100);

in my main while(1) routine too, just in case, since i saw a comment in the code that yield had to be called to keep the timer alive.

Thanks for the great code!


[Updated on: Thu, 21 May 2020 02:16]

Report message to a moderator

Re: MQTT C++ Embedded for Linux - Subscribe Messages Not Showing Up until Unsubscribe [message #1827632 is a reply to message #1827540] Tue, 19 May 2020 16:35 Go to previous messageGo to next message
Jim Rhodes is currently offline Jim RhodesFriend
Messages: 4
Registered: May 2020
Junior Member
Hi, not sure if this is posting or not, no one replied, hoping that this is something simple!
Re: MQTT C++ Embedded for Linux - Subscribe Messages Not Showing Up until Unsubscribe [message #1827699 is a reply to message #1827632] Thu, 21 May 2020 02:15 Go to previous messageGo to next message
Jim Rhodes is currently offline Jim RhodesFriend
Messages: 4
Registered: May 2020
Junior Member
A little more data...my main issue is that I can subscribe to a topic, and see it in every other client that I own, including one that I have written using the Paho NuGet client for Visual C#. All good there.

The embedded side, if I wait for the publish, does show up once, that is only if I wait for it by checking the message counter and waiting for that to increment after the publish.

Then, if in a while loop, I continue to publish every second or so, I can see the same good results. I can subscribe and publish to a number of topics, all are good to go, I get the reflection since I am also a subscriber in the embedded app. All the external clients agree as well, all good. And they can publish, and the embedded app sees that too.

I have tried to client.yield(1000) where I can, that does not make any difference. The only thing that changes my results are to subscribe, then publish over and over repeatedly.

so...

a) I can first subscribe, and publish to a topic, and I can see the publish message right away
b) if I do not publish to that same topic every 1 second, I do not see messages ever again
c) I can subscribe once, and publish repeatedly to a number of topics, all good too
d) using client.yield(100) or any number, without the repeated publishing, does not work. I do not see my embedded app publishes, or external ones
e) I watch the message counter, that does not change as well, so it's not a "printf" problem
f) I have enabled printf messages in the Countdown class to see if I am timing out, I am not, always seems to be good

Hope someone can help!
Re: MQTT C++ Embedded for Linux - Subscribe Messages Not Showing Up until Unsubscribe [message #1828246 is a reply to message #1827699] Thu, 04 June 2020 17:46 Go to previous message
Jim Rhodes is currently offline Jim RhodesFriend
Messages: 4
Registered: May 2020
Junior Member
Well this is fixed, hacked it!
Previous Topic:How to handle MQTTCLIENT_BAD_UTF8_STRING error
Next Topic:MQTT Client connect fails
Goto Forum:
  


Current Time: Thu Apr 25 23:31:05 GMT 2024

Powered by FUDForum. Page generated in 0.03538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top