floitsch
04/11/2025, 1:44 PMunsubscrided-latch variable. However, you never reinitialize that variable. Once it is set, it you can't set it anymore (leading to an exception) and the unsubscribed-latch.get will never block.
So the latch works fine the first iteration of the while loop, but then won't.
As a side note: you are unsubscribing in line 101, and then immediately subscribe again at the beginning of the loop in line 91. I'm guessing that's an artifact of other changes.
Any reason you are unsubscribing in the first place?
Also: because you are subscribing to $TOPIC/# you are receiving the data packets you are sending yourself. If you are only interested in the control messages, you should just subscribe to that topic.
I don't see any reason why you would want to use the FullClient. You don't have a permanent client-id with a continuous session. The main reason you want to have a FullClient is if you have publish calls with qos=1, that need to be in parallel, and resent if the connection goes down. MQTT partially reimplements TCP/IP (which makes it much more complicated than it needs to be), and the FullClient is responsible for all these weirdnesses. Given that you didn't even use a session, you clearly didn't need these complications.