MqttPublishingManager class

Handles the logic and workflow surrounding the message publishing and receipt process.

    It's probably worth going into a bit of the detail around publishing and Quality of Service levels
    as they are primarily the reason why message publishing has been split out into this class.

    There are 3 different QOS levels. QOS0 AtMostOnce(0), means that the message, when sent from broker to client, or
    client to broker, should be delivered at most one time, and it does not matter if the message is
    "lost". QOS 1, AtLeastOnce(1), means that the message should be successfully received by the receiving
    party at least one time, so requires some sort of acknowledgement so the sender can re-send if the
    receiver does not acknowledge.

    QOS 2 ExactlyOnce(2) is a bit more complicated as it provides the facility for guaranteed delivery of the message
    exactly one time, no more, no less.

    Each of these have different message flow between the sender and receiver.
    QOS 0 - AtMostOnce
      Sender --> Publish --> Receiver

    QOS 1 - AtLeastOnce
      Sender --> Publish --> Receiver --> PublishAck --> Sender
                                 |
                                 v
                          Message Processor

    QOS 2 - ExactlyOnce
    Sender --> Publish --> Receiver --> PublishReceived --> Sender --> PublishRelease --> Reciever --> PublishComplete --> Sender
                                                                                              |
                                                                                              v
                                                                                       Message Processor

Constructors

MqttPublishingManager(dynamic _connectionHandler, dynamic _clientEventBus)
Initializes a new instance of the PublishingManager class.

Properties

dataConvertors Map<Type, Object>
Stores a cache of data converters used when publishing data to a broker.
no setter
hashCode int
The hash code for this object.
no setterinherited
messageIdentifierDispenser MqttMessageIdentifierDispenser
Generates message identifiers for messages.
no setter
published StreamController<MqttPublishMessage>
The stream on which all confirmed published messages are added to
no setter
publishedMessages Map<int, MqttPublishMessage>
Stores messages that have been pubished but not yet acknowledged. Key is the message identifier.
no setter
publishEvent MqttMessageReceived?
Raised when a message has been recieved by the client and the relevant QOS handshake is complete.
getter/setter pair
receivedMessages Map<int, MqttPublishMessage>
Stores messages that have been received from a broker with qos level 2 (Exactly Once). Key is the message identifier.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handlePublish(MqttMessage msg) bool
Handles the receipt of publish messages from a message broker.
handlePublishAcknowledgement(MqttMessage msg) bool
Handles the receipt of publish acknowledgement messages.
handlePublishComplete(MqttMessage msg) bool
Handles a publish complete message received from a broker. Returns true if the message flow completed successfully, otherwise false.
handlePublishReceived(MqttMessage msg) bool
Handles publish received messages during processing of QOS level 2 (Exactly once) messages. Returns true or false, depending on the success of message processing.
handlePublishRelease(MqttMessage msg) bool
Handles the publish release, for messages that are undergoing Qos ExactlyOnce processing.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publish(MqttPublicationTopic topic, MqttQos qualityOfService, Uint8Buffer data, {bool retain = false, List<MqttUserProperty>? userProperties}) int
Publish a message to the broker on the specified topic at the specified Qos. with optional retain flag and user properties. Returns the message identifier assigned to the message.
publishUserMessage(MqttPublishMessage message) int
Publish a user supplied publish message. Note that if a message identifier is supplied in the message it will be overridden by this method.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited