public void publish(String subtopic, Object data) {
    try {
      MqttConnection.publish(settingsController.getMqttSettings(), subtopic, data);
    } catch (JsonProcessingException | MqttException e) {
      logger.error("Failed to publish MQTT message", e);
    }
  }
public void publish ( String subtopic , Object data ) { try { MqttConnection . publish ( settingsController . getMqttSettings ( ) , subtopic , data ) ; } catch ( JsonProcessingException | MqttException e ) { logger . error ( "Failed to publish MQTT message" , e ) ; } }
Publishes data as JSON string into given topic

@param settings MQTT settings
@param subtopic subtopic to deliver the message to.
@param data data to be send