Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Working with MQTT Triggers | MQTT Trigger Service Requirements
 
MQTT Trigger Service Requirements
The service that processes a message received by a trigger is called a trigger service. Each MQTT trigger can specify only one trigger service. Before an MQTT trigger can be enabled, the trigger service must exist on the same Integration Server.
The signature of an MQTT trigger service must expect an MQTT message as input. As a convenience, Integration Server provides the specification pub.mqtt.triggerSpec that can be used as the signature of the trigger service. Because the payload of an MQTT message received by a trigger can be decoded into a String before the trigger service executes or kept as a byte [], the payload field in the pub.mqtt.triggerSpec specification provides an option for each data type. When an MQTT trigger receives a message, Integration Server populates the MqttMessage\payload\bytes field or the MqttMessage\payload\string field depending on the decoding specified in the MQTT trigger. If the trigger service receives a byte[], make sure the trigger service includes logic to decode the byte[] into the format that you need.
If you create an MQTT trigger that subscribes to multiple topics by using wildcards, make sure to code the trigger service such that it can process messages from any of the topics.