Skip to main content

Topics and Channels

ReferenceAudience: API consumerUse: build the exact topic to publish to or subscribe to, and configure an endpoint's topics correctly

Every topic that the reader publishes to or subscribes to has three segments. You configure the middle one; the reader supplies the other two.

<tenantId>/<base topic>/<serial>

For example, with the tenant zebra, the base topic MDM/clients/cmnd and the reader RFD40-212735201D0053, the reader subscribes to zebra/MDM/clients/cmnd/RFD40-212735201D0053. This is the pattern the RFD40/RFD90 IoT API specification describes for every command, response, event and Last Will topic.

Segments​

SegmentSourceRules
<tenantId>The endpoint's tenantId. The reader adds it to the front of the topic.At most 48 characters. Case is not normalized.
<base topic>The topic value of an entry in the endpoint's mqttParams.publishTopics or mqttParams.subscribeTopicsMay contain /. A publish entry must not contain + or #.
<serial>The reader's serial number in its model-prefixed form, for example RFD40-212735201D0053. The reader adds it to the end of the topic.See Serial Number Forms.
Configure the base topic only

Don't write the tenant ID or the serial number into a topic value. The reader adds both, so a value such as acme/MGMT/clients/cmnd/<serial> produces acme/acme/MGMT/clients/cmnd/<serial>/<serial>, a topic that nothing subscribes to. The contract calls this the most common configuration mistake with this API.

Serial Number Forms​

The serial segment is the model-prefixed serial number: the model, a hyphen and the serial, for example RFD40-212735201D0053. The RFD40/RFD90 IoT API specification uses this form in every topic example. It is also the value the reader reports as deviceSerialNo in mqttConnEVT: readerVersion.model and readerVersion.serialNumber from get_version, joined by a hyphen.

The contract's examples also show a bare serial and a shorter compact form in other fields. Don't use those in topics. To address every reader in a tenant, subscribe with the single-level wildcard + in the serial position.

Direction​

The two topic arrays are named from the reader's point of view, which is the opposite of what your application does with them:

Endpoint arrayThe reader…Your application…
subscribeTopicsSubscribes, and receives commandsPublishes commands
publishTopicsPublishes responses, events, connection state, or tag dataSubscribes

Topic Slots​

The reader decides what to publish on each topic by the topic's position in publishTopics, not by its name. Names such as resp, event, and rfid are conventions only.

SlotCarries
subscribeTopics[0]Commands to the reader. It is the only topic the reader receives on.
publishTopics[0]Command responses
publishTopics[1]Events such as heartBeatEVT and alerts. On a data endpoint, tag data instead.
publishTopics[2]mqttConnEVT, and the Last Will that the broker publishes

What to configure depends on the endpoint type:

epTypesubscribeTopics[0]publishTopics[0]publishTopics[1]publishTopics[2]
MGMT, MDMRequired: commandsRequired: responsesRecommended: eventsRecommended: mqttConnEVT and Last Will
CTRLRequired: control commandsRequired: control responsesOptional: stored, but not used for eventsOptional: mqttConnEVT and Last Will
MGMT_EVTRequired: events are published on this topicNot usedNot usedOptional: Last Will
DATA1Not usedNot used for tag dataRequired: tag dataOptional: Last Will

A slot marked Not used can still be sent and is stored, but it carries nothing for that endpoint type. DATA2 is currently not supported, so DATA1 is the only data endpoint type.

Firmware defect: MGMT_EVT

A MGMT_EVT endpoint currently publishes its events on its subscribe topic, not on publishTopics[1]. The contract records this as a firmware defect that the API owners intend to correct. Confirm the behavior on the firmware you target before you depend on it.

Rules for the Arrays​

  • Position routes traffic. Swapping two entries sends live traffic to different topics, and the configuration stays valid.
  • The array is read from index 0. You can't configure only publishTopics[1]. To reach slot 1, send an entry in slot 0 as well.
  • Data endpoints need two entries. A data endpoint with a single publishTopics entry puts it in the response slot: the endpoint is created, the command succeeds, and no tag data arrives. Use a filler entry in slot 0, as in the data endpoint example.
  • Read-backs are positional too. get_endpoint_config returns the entries in slot order. A read-back with fewer than three entries does not say which slots are unused.

Default Topics​

The reader firmware's default endpoint configurations use these base topics. They show the conventional layout for each endpoint type; a dash means the slot is empty by default.

Default endpointsubscribeTopics[0]publishTopics[0]publishTopics[1]publishTopics[2] (Last Will)
MGMT_EPMGMT/clients/cmndMGMT/clients/resp—MGMT/clients/rfid
MDM_EPMDM/clients/cmndMDM/clients/respMDM/clients/eventMDM/clients/rfid
CTRL_EPCTRL/clients/cmndCTRL/clients/respCTRL/clients/eventCTRL/clients/rfid
DATA1_EP——DATA/clients/data1event—
DATA2_EP——DATA/clients/data2event—
MGMT_EVT———MGMTEVT/clients/event

In the defaults, every topic uses QoS 0 and only the Last Will topic is retained. The two default data endpoints batch tag data with a reportingInterval of 1000 ms and a maxPayloadSizePerReport of 1024 bytes. DATA2 is currently not supported.

Conventional Base Topics​

The contract's topic addresses follow the pattern <endpoint base>/clients/<token>. They are a convention, not a requirement: you can choose your own base topics.

TokenSlotDirection
cmndsubscribeTopics[0]Application → reader
resppublishTopics[0]Reader → application
eventpublishTopics[1]Reader → application
rfidpublishTopics[2]; also tag data when inventory output goes to a management or control endpointReader → application
data1eventpublishTopics[1] on a DATA1 endpoint, under the base DATA. (data2event belongs to DATA2, which is currently not supported.)Reader → application

The endpoint bases in the contract's topic addresses are MGMT, MGMT_EVT, CTRL, MDM, and DATA. The reference test device used MDM as its management base rather than MGMT.

Worked Example​

This config_endpoint request adds a management endpoint with the tenant ZEBRA and the conventional management topics.

config_endpoint request: add a management endpoint over TLS (contract example: Add MGMT endpoint for MQTT TLS)
{
"command": "config_endpoint",
"requestId": "1233",
"epConfig": {
"operation": "add",
"configuration": {
"endpointName": "mgmt_tls",
"epType": "MGMT",
"protocol": "MQTT_TLS",
"activate": true,
"url": "broker.ip.com",
"port": 8883,
"verificationType": "VERIFY_HOST_AND_PEER",
"qosCommon": 1,
"tenantId": "ZEBRA",
"mqttParams": {
"keepAlive": 300,
"cleanSession": true,
"reconnectDelayMin": 5,
"reconnectDelayMax": 60,
"publishTopics": [
{
"topic": "MGMT/clients/resp",
"qos": 1,
"retain": false
},
{
"topic": "MGMT/clients/event",
"qos": 1,
"retain": false
},
{
"topic": "MGMT/clients/rfid",
"qos": 0,
"retain": true
}
],
"subscribeTopics": [
{
"topic": "MGMT/clients/cmnd",
"qos": 0
}
]
},
"securityParams": {
"format": "PEM",
"caCertificateFile": "mqtt_ca_cert",
"clientCert": "mqtt_client_cert",
"clientKey": "mqtt_client_key"
}
}
}
}

On the reader RFD40-211545201D0034, the endpoint uses these topics:

TrafficSlotTopicYour application
CommandssubscribeTopics[0]ZEBRA/MGMT/clients/cmnd/RFD40-211545201D0034Publishes
ResponsespublishTopics[0]ZEBRA/MGMT/clients/resp/RFD40-211545201D0034Subscribes
EventspublishTopics[1]ZEBRA/MGMT/clients/event/RFD40-211545201D0034Subscribes
mqttConnEVT and Last WillpublishTopics[2]ZEBRA/MGMT/clients/rfid/RFD40-211545201D0034Subscribes

To receive responses from every reader in the tenant, subscribe to ZEBRA/MGMT/clients/resp/+.

Data Endpoint Example​

A DATA1 endpoint puts a filler entry in slot 0 so that the tag-data topic lands in slot 1. Every DATA1 example in the contract uses this publishTopics array. The filler topic needs no delivery guarantee.

publishTopics for a DATA1 endpoint, as in the contract's DATA1 examples
{
"publishTopics": [
{
"topic": "DATA/clients/unused",
"qos": 0,
"retain": false
},
{
"topic": "DATA/clients/data1event",
"qos": 1,
"retain": false
}
]
}

With the tenant ZEBRA, tag data then arrives on ZEBRA/DATA/clients/data1event/RFD40-211545201D0034. DATA2 is currently not supported.

Topic Limits​

LimitValueIf exceeded
Publish topics per endpoint3config_endpoint returns code 25
Subscribe topics per endpoint1config_endpoint returns code 26. Some published read-backs report three subscribe topics, so don't reject a read-back that has more than one.
tenantId length48 charactersconfig_endpoint returns code 27
Topic lengthAt least 1 character; at most 65,535 bytes when UTF-8 encodedNot specified in the available sources
Wildcards+ and # are not allowed in publish topics. Subscribe topic filters may use them.Not specified in the available sources

Not Specified​

  • The topic the reader uses when tenantId is empty.
  • Whether an endpoint accepts commands that belong to another endpoint type, for example a control command on a MGMT endpoint.

Related: 📕 Broker Connection · 📕 Message Envelopes and Correlation · 📕 config_endpoint · 📕 MQTT Endpoints · 📕 Endpoints and Topic Slots

Was this helpful?