Add Subscriptions to Broker Connection

Subscriptions are created under the Broker(s) to subscribe to the data parameters.

The following subscription types are supported:
  1. JSON
  2. Sparkplug-B
Note:
Depending on the IoT data received from the client, you can select the JSON or Sparkplug subscription type.

A subscription is added to a broker connection and a tag is added to a subscription.

To add a Subscription to a Broker Connection:
  1. Select Add Subscription.

    The New Subscription dialog appears.

  2. Select Subscription Type (JSON or Sparkplug Bv1.0).
    • If you select JSON, enter a Subscription Name, and a Topic Name, and then click Add.
      Note:
      • Adhere to the following rules when entering information:
        • Do not include spaces in between the names.
        • Names cannot have leading or trailing spaces.
        • The only special characters allowed are '_' and '-'.
        • Subscription names must start with a letter.
        • Field names cannot be blank. Duplicate names are not allowed.
        • Subscription names cannot exceed 255 bytes.


      The JSON subscription is added to the broker connection. Click Save.

    • If you select Sparkplug, enter Subscription Name, Group Id, Edge Node Id, and Device Id, and then click Add.
      Note:
      • Adhere to the following rules when entering information:
        • Subscription names must start with a letter and cannot exceed 255 characters.
        • The only special characters allowed are '_' and '-'.
        • Do not include spaces in between the names.
        • Names cannot have leading or trailing spaces.
        • For Group Id and Edge Node Id, the special characters + and # are not allowed.
        • Field names cannot be left blank (the Device Id field can be left blank if the subscription is for an Edge Node). Duplicate names are not allowed.


      The Sparkplug subscription is added to the broker connection. Click Save.

      Table 1. Subscription Details
      Field Value
      GENERAL
      Name Enter a name for the subscription.
      Description Enter the description for the subscription.
      Disabled Enables or disables the subscription with the client:
      • True: The subscription is disabled.
      • False: The subscription is enabled.
      SUBSCRIPTION DETAILS
      QoS The Quality of Service (QoS) specifies three levels (QoS0, QoS1, and QoS2) at which the messages are delivered between the publishing client (sender) to the broker (receiver) and from the broker (sender) to the subscribing client (receiver). The QoS level selection provides easy communication even when the network is not reliable.
      • QoS0: At most once
        • No assurance of message delivery.
        • Best efforts to deliver message only once.
        • No acknowledgement receipt of the message from the receiver, message is not transmitted back to the sender, and the message is not stored.
      • QoS1: At least once
        • Ensures message delivery at least once to the receiver.
        • Does not prevent delivering the messages multiple times to the receiver.
        • Receiver acknowledges the message, and the sender stores the message.
      • QoS2: Exactly once
        • Ensures each message is delivered to the receiver only once.
        • Receiver confirms the message delivery for each message from the sender.
        • Requires two request/response flows between the sender and the receiver.
        • Receiver acknowledges the message, and the sender stores the messages.
        • Acknowledgement of delivered messages are received by the sender until the published messages are available to use.
        Note:
        QoS2 level is most reliable, but the quality of service is slower than QoS0 and QoS1.
      Tags Discovery Duration (in sec) The Tags Discovery Duration is the duration period to fetch the tags. Tags fetched after the discovery are then added to the topic subscribed. This parameter helps the user to dynamically fetch the tags for a specific topic name and for a specific time duration. By default, the tags discovery duration is set to 120 seconds. You can modify the value as required.
      Note:
      • You can select Start Tag Discovery, Stop Tag Discovery, and Show Discovered Tags by using the overflow icon , next to the subscription.
      • If you select Start Tag Discovery, the Time Remaining in seconds is displayed.
      • After the time remaining ends, or if you prematurely stop the tag discovery, select Show Discovered Tags to view the published tags. You can modify the Data Type and Read Write parameters. If modified, select the specific tag, and then click Add to view the modified tag to the tags list for the topic subscribed.
      Subscription Type Displays the subscription type.
      JSON Subscription
      Topic Name Enter a topic name to which you want to subscribe.
      Example:
      • Entering test1/# indicates that the client can listen to any topic that starts with test1/.
        Note:
        The character # is a key word that has to be the last value. You can choose to enter any topic name in place of the key word # to differentiate multiple topics. That is, if you enter test1/test2, the client can listen explicitly to test1/test2.
      • Entering test1/+/temperature indicates that the client can listen to any topic name used in place of + to differentiate a single topic.
        Note:
        The character + is a key word between test1 and temperature. If you enter test1/test2/temperature, the client can listen explicitly to test1/test2/temperature.
      Publish Topic Name Publish Topic Name, if provided by the user, will be used by the MQTT client when publishing the data; that is, when a user writes to a specific tag in the subscription using the OPC UA client, the data will be published with that specific publish topic name.
      Note:
      If the Publish Topic Name field is left empty, then no data will be published to the broker even though the user modifies on the OPC UA side.
      Flatten Leaf Arrays The Flatten Leaf Array parameter is used to consider the array tags as a whole or flatten the tag arrays (for example, if you have 100 elements in a JSON array, then you can choose to create a single array tag or, create 100 unique tags each pointing to an array element). By default, Flatten Leaf Arrays is set to True.
      • True: A unique tag for each element of the array will be created.
      • False: A single array tag for all the elements will be created. Also, the Configure Leaf Array Elements are enabled to configure the respective tag elements in TAG DETAILS section.
        Note:
        The Configure Leaf Array Elements (that is, Leaf Array Rank, Leaf Array Dimensions, and Leaf Array Data Type) are able to be configured only if the Data Type is set to DataSet.
      Sparkplug Subscription
      Group Id Enter a Group Id for the topic subscribed.
      Edge Node Id Enter an Edge Node Id for the topic subscribed.
      Device Id Enter a Device Id for the topic subscribed. The topic device id is the identification of a device attached to the MQTT Edge node. The device id field is optional.
      Note:
      • If the Device ID field is left empty, it will be considered an Edge node.
      • If you enter the Device ID field, it will be considered as a Device node.
      Important:
      After configuring the changes, click Save to save the connection parameters.

Any application requesting the data from the MQTT broker is subscribed to the JSON or Sparkplug type depending on the data loaded from the IoT.

Tags are added under the Subscriptions to store specific data from the subscription. Refer to Add Tags to Subscription to add Tags under each Subscription.