IPWorks MQ 2020 Python Edition

Questions / Feedback?

on_message_out Event

Fired when an outgoing message has been sent and/or fully acknowledged.

Syntax

class MQTTMessageOutEventParams(object):
  @property
  def packet_id() -> int: ...
  @property
  def topic() -> str: ...
  @property
  def qos() -> int: ...
  @property
  def message() -> bytes: ...
  @property
  def retained() -> bool: ...
  @property
  def duplicate() -> bool: ...

# In class MQTT:
@property
def on_message_out() -> Callable[[MQTTMessageOutEventParams], None]: ...
@on_message_out.setter
def on_message_out(event_hook: Callable[[MQTTMessageOutEventParams], None]) -> None: ...

Remarks

The on_message_out event fires once for each outgoing message either immediately after it is sent (QoS 0), or after it has been fully acknowledged by the receiver (QoS 1 and 2).

  • PacketId: The message packet Id. This will always be -1 if QOS is 0.
  • Topic: The message's topic string.
  • QOS: The message's QoS level.
  • Message: The message data.
  • Retained: Whether or not this message was sent with the "Retain" flag set.
  • Duplicate: Whether or not this message was sent with the "Duplicate" flag set.

Refer to on_message_ack for more information about QoS 1 and 2 message processing steps.


// MessageOut event handler.
mqtt1.OnMessageOut += (s, e) => {
  Console.WriteLine("Send message to topic '" + e.Topic + "' with QoS " + e.QOS + ":");
  Console.WriteLine(e.Message);
};

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 Python Edition - Version 20.0 [Build 8155]