Subscription/Unsubscription
Subscribe
The FE needs an attached link with sender role to the Subscription Service control address. The MQTT SUBSCRIBE and UNSUBSCRIBE messages, that will be handled, have QoS level 1 (AT_LEAST_ONCE) by nature so the attached link should have :
- rcv-settle-mode : first (0)
- snd-settle-mode : unsettled (0)
The MQTT client sends a SUBSCRIBE message to FE which maps the SUBSCRIBE message to the following AMQP message.
AMQP_SUBSCRIBE : sent to the SS in order to ask establishing a route between the topics and unique client publish address $mqtt.to.[client-id].publish.
| DATA | TYPE | VALUE | FROM |
|---|---|---|---|
| subject | system property | "subscribe" | - |
| message-id | system property | MessageId | MQTT SUBSCRIBE |
| correlation-id | system property | $mqtt.to.[client-id].publish | - |
| payload | AMQP value | Map with topics (as key) and qos (as value) | MQTT SUSBCRIBE |
the payload is a map with topics used as key and the related qos as corresponding value
The AMQP_SUBSCRIBE is sent as "unsettled", in order to know that the Subscription Service has received it (with related disposition). The related disposition could be :
- ACCEPTED : then the FE builds a SUBACK message for MQTT client using the same requested QoS as granted QoS
- REJECTED : then the FE builds a SUBACK message for MQTT client using 0x80 (failure) as granted QoS
The FE builds the SUBACK message as response for the MQTT client.
SUBACK
| DATA | VALUE | FROM |
|---|---|---|
| MessagId | message-id | AMQP_SUBSCRIBE |
| Return codes | List of granted QoS (or failure) | AMQP_SUBSCRIBE |
The FE could also receive the following AMQP_PUBLISH message (as a retained message) on the unique client address and builds the PUBLISH for the MQTT client.
AMQP_PUBLISH : the retained message to deliver to the client (see “Publishing”)
the retained message is sent to the unique client address and it's not published on the topic because only that client should receive the message (not all the other subscribers for the topic itself).
Starting from now, when subscribed/attached, the FE receives published messages on the unique client address :
- $mqtt.to.[client-id].publish
The AMQP message is used by FE for building the PUBLISH message to send to the MQTT client (see “Publishing”).

Unsubscribe
The MQTT client sends an UNSUBSCRIBE message to FE which maps to the following AMQP message.
AMQP_UNSUBSCRIBE : sent to the SS in order to ask removing the established route between the topic and unique client publish address $mqtt.to.[client-id].publish.
| DATA | TYPE | VALUE | FROM |
|---|---|---|---|
| subject | system property | "unsubscribe" | - |
| message-id | system property | MessageId | MQTT UNSUBSCRIBE |
| correlation-id | system property | $mqtt.to.[client-id].publish | - |
| payload | AMQP value | List of topics | MQTT UNSUBSCRIBE |
The AMQP_UNSUBSCRIBE is sent as "unsettled", in order to know that the Subscription Service has received it (with related disposition). When FE receives tha related disposition (with "settled") it builds the UNSUBACK message for MQTT client.
UNSUBACK
| DATA | VALUE | FROM |
|---|---|---|
| MessagId | message-id | AMQP_UNSUBSCRIBE |
