IPWorks IoT 2020 Python Edition

Questions / Feedback?

on_message_returned Event

Fires if a previously published message is returned by the server due to it being undeliverable.

Syntax

class AMQPClassicMessageReturnedEventParams(object):
  @property
  def channel_name() -> str: ...
  @property
  def reply_code() -> int: ...
  @property
  def reply_text() -> str: ...
  @property
  def exchange_name() -> str: ...
  @property
  def routing_key() -> str: ...

# In class AMQPClassic:
@property
def on_message_returned() -> Callable[[AMQPClassicMessageReturnedEventParams], None]: ...
@on_message_returned.setter
def on_message_returned(event_hook: Callable[[AMQPClassicMessageReturnedEventParams], None]) -> None: ...

Remarks

This event fires if the server returns a previously published message because it could not deliver it. Typically, messages are only undeliverable in one of the following situations:

  • The message was originally published with the Mandatory option enabled, but there were no queues it could be routed to.
  • The message was originally published with the Immediate option enabled, but there were no consumers it could be delivered to immediately on any queue it was routed to (or there were no queues it could be routed to).

The ReceivedMessage* properties will be populated with the returned message.

ChannelName reflects the name of the channel the message was originally published on.

ReplyCode will be an AMQP error code that indicates the reason why the message was returned. (Tip: The AMQPClassic class's Error Codes page includes the various AMQP error codes.)

ReplyText will be a message with further details about why the message was returned.

ExchangeName reflects the name of the exchange to which the message was originally published. (If the message was originally published to the server's default exchange, whose name is always the empty string, ExchangeName will also be empty.)

RoutingKey reflects the routing key that the message was originally published with.

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