Separate Java examples of MQTT Publisher & Subscriber.
(Examples I encountered when learning to work with MQTT combined both the sender and the receiver logic. Here, I’ve separated them out.)
Note: You’ll need to start the publisher
quickly as the subscriber will only wait to listen for events for 15 secs by default.
Audit/logging output is written to stdout
so you should see some send/receive messages in both consoles.