Designer 10.5 | webMethods Service Development Help | Working with MQTT Triggers | Creating an MQTT Trigger
 
Creating an MQTT Trigger
When you create an MQTT trigger, keep the following guidelines in mind:
*For an MQTT trigger to be enabled, it must meet the requirements listed in MQTT Trigger Requirements.
*The topic to which the MQTT subscribes does not need to exist prior to creating the trigger. The trigger client creates the topic when it connects to the MQTT server.
*MQTT trigger supports the use of the single level wildcard “+” and the multi-level wildcard “#” in topics.
*The MQTT connection alias determines whether the subscriptions created by the trigger are persisted across sessions. Make sure to select an MQTT connection alias that supports your requirements for the MQTT trigger.
*The QoS that you select for an MQTT trigger applies only to the subscription. That is, the QoS applies to message delivery between the MQTT server and the MQTT trigger. It does not apply to message processing by the trigger or trigger service.
*In conjunction with the MQTT connection alias, the QoS for an MQTT trigger determines whether an MQTT trigger can obtain messages published to a topic when the trigger was disconnected. If the MQTT connection alias does not use clean sessions for subscriptions and the QoS for the MQTT trigger is set to At least once (1) or Exactly once (2), the MQTT trigger receives missed messages upon reconnection to the MQTT server.
*The QoS for publishing messages to the MQTT server is separate from the QoS for receiving messages. As a result, it is possible for a message to be published to the MQTT server with a higher QoS than which the message is received from the MQTT server. However, it is not possible for a message to be received from the MQTT server at a higher QoS level than which it was published to the MQTT server. When sending the message to the MQTT trigger, the MQTT server uses the lower QoS regardless of whether it was set by the message publisher or by the MQTT trigger.
*Make sure to establish package dependencies between the packages that contain the MQTT trigger, the MQTT trigger services, and the package that contains the MQTT connection alias definition.
*To create an MQTT trigger
1. In the Package Navigator view of Designer, click File > New > MQTT Trigger.
2. In the New MQTT Trigger dialog box, select the folder in which you want to save the MQTT trigger.
3. In the Element name field, type a name for the MQTT trigger using any combination of letters, numbers, and/or the underscore character. For information about restricted characters, see About Element Names.
4. Click Finish.
Designer creates the trigger and opens the MQTT trigger editor.
5. In the MQTT connection alias name field of the Trigger Settings tab, click .
6. In the Select a MQTT connection alias for triggerName dialog box, select the MQTT connection alias that you want this t rigger to use to connect to the MQTT server, establish subscriptions, and receive messages. Click OK.
If a MQTT connection alas as has not yet been configured on Integration Server, Designer displays a message stating that the MQTT subsystem has not been configured. For information about creating an MQTT connection alias, see the webMethods Integration Server Administrator’s Guide.
7. In the Topic field, specify the topic to which the MQTT trigger subscribes. You can specify a single topic string only.
You can subscribe to a topic pattern by including a wildcard in the topic string. MQTT triggers support the single-level wildcard “+” and the multi-level wildcard “#”.
8. In the QoS list, select the quality of service for message delivery between the MQTT server and the MQTT trigger.
Select one of the QoS levels described in the following table:
QoS Level
Description
At most once (0)
The MQTT server delivers the message to the MQTT trigger once or not at all. This is sometimes referred to as “fire and forget”.
At least once (1)
The MQTT server delivers the message to the MQTT trigger one or more times. This is the default.
Exactly once (2)
The MQTT server delivers the message to the MQTT trigger once and only once.
9. In the Service field, type the fully qualified name of the service to use as the trigger service or click to navigate to and select the service.
10. In the Decoding Type list, select how Integration Server decodes the payload of the MQTT message when placing it in the input pipeline for the trigger service.
Select one of the decoding types specified in the following table.
Decoding Type
Description
Payload to byte[]
Integration Server passes the MQTT message payload as a byte[] to the trigger service.
This is the default.
Payload to String
Integration Server decodes the MQTT message payload, which is a byte[], into a String before invoking the trigger service.
11. In the Properties view, set properties for the MQTT trigger.
12. Enter comments or notes about the MQTT trigger, if any, in the Comments tab.
13. Click File > Save.
Notes:
*If the MQTT trigger is saved in an enabled state and the MQTT connection alias is enabled and running, the MQTT trigger starts.
*If the MQTT trigger is saved in an enabled state but the MQTT connection alias is disabled or enabled but not running, the MQTT trigger is not connected and does not start.
*If the MQTT trigger is missing required information, such as a trigger service or an MQTTT connection alias, Designer prompts you to save the trigger in a disabled state.