The optional "validateMqttPayload" property is a Boolean property that defaults to the value of "defaultValidateMqttPayload" in the services.json settings file, which is true by default.
When true, the MQTT broker validates the payload of each MQTT message to verify that it matches the type specified by the "mqttPayloadType" property.
If a payload fails validation, the message is delivered without change to all subscribers. The broker also sets the error field to true and adds an error object to the log field (see the error object example). Users, applications, and JavaScript transform steps can read the values of the error and log fields to know when incoming content is invalid.
When false, the MQTT broker does not validate the payload. This increases message throughput because validation increases the time it takes to process each message. Without validation, the broker cannot update the error and log fields to indicate when content is invalid. Lastly, invalid content can cause problems for subscribers and JavaScript transforms that expect valid content.
Example error object describing an invalid MQTT payload
[
{
"errorCode": 12046,
"errorMessage": "Payload is not a valid JSON.",
"errorSource": "MQTT payload format"
}
]