OutgoingMessages Property
Collection of outgoing messages with QoS > 0 that have not been fully acknowledged.
Syntax
public val outgoingMessages: MQTTMessageList
Remarks
Each time the component publishes a message with a QoS of 1 or 2, it adds it to the OutgoingMessages collection after the initial PUBLISH packet is sent (this does not occur for messages publish with a QoS of 0). A message remains in the OutgoingMessages collection until the component has completed all of the acknowledgment steps required for it based on its QoS level.
Outgoing messages with a QoS of 1 follow these steps:
- The component sends the PUBLISH packet, then adds the message to OutgoingMessages.
- The component waits to receive a PUBACK (publish acknowledgment) packet.
- The MessageAck event is fired.
- The message is removed from OutgoingMessages.
- The MessageOut event is fired.
Outgoing messages with a QoS of 2 follow these steps:
- The component sends the PUBLISH packet, then adds the message to OutgoingMessages.
- The component waits to receive a PUBREC (publish received) packet.
- The component sends a PUBREL (publish release) packet in response.
- The component waits to receive a PUBCOMP (publish complete) packet.
- The MessageAck event is fired.
- The message is removed from OutgoingMessages.
- The MessageOut event is fired.
In MQTT 3.1.1, the RepublishInterval configuration setting, if set to a non-zero value (default), controls how long the component will wait to receive a PUBACK (for QoS 1) or PUBREC (for QoS 2) before automatically republishing an outgoing message. In MQTT 5, messages are only republished if the client is disconnected before receiving a PUBACK or PUBREC.
The component processes messages anytime DoEvents is called. In applications with a GUI, the DoEvents method is also typically called automatically when the component is idle. In all other situations however, it is best practice to call DoEvents in a loop when possible to ensure timely processing of messages.
This collection is indexed from 0 to size - 1.
This property is read-only and not available at design time.