This is a quick post to share a sample code using Eclipse Paho for MQTT. Recommended: First steps with MQTT using Mosquitto Some may prefer to use REST or Websockets, but MQTT is the standard protocol to connect things to the Internet. Even a small NodeMCU can read and publish on MQTT topics. You can configure a RaspberryPi instance to be a mqtt server or even use a cloud MQTT server, such as Paho, Mosquitto and other servers on the cloud. There are also paid services such as Amazon AWS. Here' s a very simple code to say hello from a Java application.
Blog about programming and client applications. Target Programming languages are JavaFX, Visage, HTML 5+ Javascript or even command line apps :-D