Now, you're ready to learn how to write a simple Java program with the Eclipse Paho Java client to publish data to a feed. You have already set up the Temperature feed with Adafruit IO. Listing 4-1 presents the Java program that can be used to publish random values between 0-100 to the Temperature feed every 60 seconds.
Type all the lines from listing 4-1 into the IoTDashboard.java file. The IoTDashboard.java file includes the main method.
Listing 4-1: IoTDashboard.java
package com.packt.B05688.chapter4;import org.eclipse.paho.client.mqttv3.MqttClient;import org.eclipse.paho.client.mqttv3.MqttConnectOptions;import org.eclipse.paho.client.mqttv3.MqttException;import org.eclipse.paho.client.mqttv3.MqttMessage; ...