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
- connectionHandler ↔ IMqttConnectionHandler
-
The current connection handler.
read / write
-
dataConverters
↔ Map<
Type, Object> -
Stores a cache of data converters used when publishing data to a broker.
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- messageIdentifierDispenser ↔ MessageIdentifierDispenser
-
Handles dispensing of message ids for messages published to a topic.
read / write
-
published
→ StreamController<
MqttPublishMessage> -
The stream on which all confirmed published messages are added to
read-only
-
publishedMessages
↔ Map<
int, MqttPublishMessage> -
Stores messages that have been pubished but not yet acknowledged.
read / write
- publishEvent ↔ MessageReceived
-
Raised when a message has been recieved by the client and the relevant QOS handshake is complete.
read / write, override
-
receivedMessages
↔ Map<
int, MqttPublishMessage> -
Stores messages that have been received from a broker with qos level 2 (Exactly Once).
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
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. This callback simply removes it from the list of published 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 non-existent 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 -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited