PublishingManager 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.</para>
    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
Implemented types

Constructors

PublishingManager(IMqttConnectionHandler? connectionHandler, EventBus? _clientEventBus)
Initializes a new instance of the PublishingManager class.

Properties

awaitingManualAcknowledge Map<int, MqttPublishMessage>
Stores Qos 1 messages that have been received but not yet acknowledged as manual acknowledgement has been selected.
getter/setter pair
connectionHandler IMqttConnectionHandler?
The current connection handler.
getter/setter pair
dataConverters Map<Type, Object>
Stores a cache of data converters used when publishing data to a broker.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
manuallyAcknowledgeQos1 bool
Indicates that received QOS 1 messages(AtLeastOnce) are not to be automatically acknowledged by the client. The user must do this when the message has been taken off the update stream using the acknowledgeQos1Message method.
getter/setter pair
messageIdentifierDispenser MessageIdentifierDispenser
Handles dispensing of message ids for messages published to a topic.
getter/setter pair
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.
getter/setter pair
publishEvent MessageReceived?
Raised when a message has been received by the client and the relevant QOS handshake is complete.
getter/setter pairoverride
receivedMessages Map<int?, MqttPublishMessage>
Stores messages that have been received from a broker with qos level 2 (Exactly Once).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acknowledgeQos1Message(MqttPublishMessage message) bool
Manually acknowledge a received QOS 1 message. Has no effect if manuallyAcknowledgeQos1 is not in force or the message is not awaiting a QOS 1 acknowledge. Returns true if an acknowledgement is sent to the broker.
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(PublicationTopic topic, MqttQos qualityOfService, Uint8Buffer data, [bool retain = false]) int
Publish a message to the broker on the specified topic. The topic to send the message to The QOS to use when publishing the message. The message to send. The message identifier assigned to the message.
override
toString() String
A string representation of this object.
inherited

Operators

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