code: @RobotKeyword("Publish to MQTT Synchronously")
      @ArgumentNames({ "topic", "message", "qos=0", "retained=false" })
      public void publishToMQTTSynchronously(String topic, Object message,
              int qos, boolean retained) throws MqttException {
          MqttMessage msg;
          if (message instanceof String) {
              msg = new MqttMessage(message.toString().getBytes());
          } else {
              msg = new MqttMessage((byte[]) message);
          }
          msg.setQos(qos);
          msg.setRetained(retained);
          System.out.println("*INFO:" + System.currentTimeMillis()
                  + "* publishing message");
          client.publish(topic, msg);
          System.out.println("*INFO:" + System.currentTimeMillis()
                  + "* published");
      }
docs: Publish a message to a topic with specified qos and retained flag
  
  @param topic
  topic to which the message will be published
  @param message
  message payload to publish
  @param qos
  qos of the message
  @param retained
  retained flag
  @throws MqttException
  if there is an issue publishing to the broker