-
For the sample pub&sub, in cpp file PubSub.cpp, There are 2 problems. Problem2: function SubscribeCallback didn't print out any messages after starting the program Please have a check. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Did you make sure to remove the locks in the sample: {
std::unique_lock<std::mutex> receivedLock(receiveMutex);
receiveSignal.wait(receivedLock, [&] { return receivedCount >= messageCount; });
} The PubSub sample only prints the messages when it receives them back from the IoT core. Since you don't subscribe to the topic you won't receive anything. And if you don't remove the lock mentioned above then the program will send one message then wait to receive one before continuing and sending the second publish |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Did you make sure to remove the locks in the sample:
The PubSub sample only prints the messages when it receives them back from the IoT core. Since you don't subscribe to the topic you won't receive anything. And if you don't remove the lock mentioned above then the program will send one message then wait to receive one before continuing and sending the second publish