TR50 MQTT Publish Receive

The TR50 MQTT Publish Receive event subscribes to MQTT publishes being sent on the MQTT bus underlying the TR50 Connection. The MQTT Publish action will allow custom data publishing to the MQTT Broker within the M2M Service, and therefore provide access to additional functions supported by the deviceWISE Cloud. The MQTT Publish Receive event will listen on a specific topic being published.
For information on supported functions, see MQTT Interface and its child pages.

Defining a TR50 MQTT Publish Receive event trigger

To define a TR50 MQTT Publish Receive event trigger, follow these steps:

  1. From the Workbench left pane, expand the node where you want to define the TR50 MQTT Publish Receive event trigger.
  2. Select the Project icon to display the Projects window, right-click a specific project tab to display its pop-up menu, and then select New.
    You also can select the New button at the bottom of the Projects window when a specific project tab has already been selected.
  3. 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.
  4. From the Event tab, select the Trigger Event Type down-arrow, expand the TR50 category, and then select TR50 MQTT Publish Receive.

    The Event tab becomes active with parameters that accommodate the TR50 MQTT Publish Receive event.
Parameter Description
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:

  1. The '#' is a wildcard character that matches any number of levels within a topic, referred to as the multi-level wildcard.
    1. The multi-level wildcard character must be specified either on its own or following a topic level separator, where a topic level separator is a '/' character.
    2. The multi-level wildcard must be the last character specified in the Topic Filter.
    3. The multi-level wildcard includes the parent level.
    4. The multi-level wildcard can be specified alone and will subscribe to all messages.
    5. Usage examples:
      1. "sport/tennis/player1/#" matches "sport/tennis/player1", "sport/tennis/player1/ranking", "sport/tennis/player1/score/wimbledon"
      2. "sport/#" also matches the singular "sport", since # includes the parent level.
      3. "#" is valid and will receive every application message.
      4. "sport/tennis/#" is valid.
      5. "sport/tennis#" is not valid.
      6.  sport/tennis/#/ranking" is not valid.
  2. The '+' is a wildcard  that matches only one topic level, referred to as the single-level wildcard.
    1. The single-level wildcard can be used at any level in the Topic Filter, including first and last levels.
    2. The single-level wildcard must occupy the entire level of the filter.
    3. The single-level wildcard matches only a single level.
    4. Usage examples:
      1. “sport/tennis/+" matches "sport/tennis/player1" and "sport/tennis/player2" but not "sport/tennis/player1/ranking".
      2. "sport/+" does not match “sport” but it does match “sport/” due to the single level matching restriction.
      3. "+" is valid
      4. "+/tennis/#" is valid
      5. "sport+" is not valid
      6. "sport/+/player1" is valid
      7. "/finance" matches "+/+" and "/+", but not "+"
Quality of Service Quality of service (QoS) that is used to send the publish. Default is set to 0.
  1. QoS 0: The defined behavior for QoS 0 is that an acknowledge for a subscribed topic is not expected from the gateway when the subscribed topic data is sent from the MQTT Broker.
  2. QoS 1: The defined behavior for QoS 1 is that an acknowledge for a subscribed topic is expected from the gateway when the subscribed topic data is sent from the MQTT Broker.
Payload Type Type of payload to receive, either String or Binary. The default is set to String.

TR50 MQTT Publish Receive event type trigger event variables

The input event variables available to a TR50 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.
Related Topics

IoT Portal API Reference Guide

TR50 MQTT Publish