MQTT Publish Receive
The MQTT Publish Receive event subscribes to a topic for MQTT publishes being sent on the MQTT device's MQTT connection. The MQTT Publish Receive event will listen on a specific topic being published by the MQTT broker.
Defining a MQTT Publish Receive event trigger
To define a MQTT Publish Receive event trigger, follow these steps:
- From the Workbench left pane, expand the node where you want to define the MQTT Publish Receive event trigger.
- Click Project to display the Projects window.
- Right-click a specific project to display its short cut menu, and then select New.
It is also possible to click New button at the bottom of the Projects window when a specific project has already been selected. -
The new Trigger window appears.
Name the trigger. The trigger name can be up to 64 characters and include letters, numbers, and the underscore character. Spaces are allowed. -
From the Event tab, select the Trigger Event Type down-arrow, expand the Networking category, and then select MQTT Publish Receive.
The Event tab becomes active with parameters that accommodate the MQTT Publish Receive event.
Parameter | Description |
---|---|
MQTT Client | The MQTT device that represents the MQTT connection to use for this subscription. The list contains the MQTT devices on this gateway. |
Topic Filter |
An expression is used to specify one or more topic names the subscription should filter on when subscribing to publishes from the MQTT broker.
This expression can include wildcard characters to filter on. This field is required and supports a String up to 65535 bytes. Wildcard characters '+' and '#' are supported as follows:
|
Quality of Service |
Quality of service (QoS) that is used to send the publish. Default is set to 0.
|
Payload Type | Type of payload to receive, either String or Binary. The default is String. |
MQTT Publish Receive event type trigger event variables
The input event variables available to a MQTT Publish Receive event trigger are:
Event variable | Data type | Description |
---|---|---|
Topic | STRING | The topic name of the incoming publish. |
Payload | STRING or BINARY | The payload of the incoming publish. The data type depends on the option selected for the Payload Type parameter. |
Payload Length | UINT4 | The length of the Payload for the incoming publish. |