MessageReturned Event

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

Syntax

public event OnMessageReturnedHandler OnMessageReturned;

public delegate void OnMessageReturnedHandler(object sender, AmqpclassicMessageReturnedEventArgs e);

public class AmqpclassicMessageReturnedEventArgs : EventArgs {
  public string ChannelName { get; }
  public int ReplyCode { get; }
  public string ReplyText { get; }
  public string ExchangeName { get; }
  public string RoutingKey { get; }
}
Public Event OnMessageReturned As OnMessageReturnedHandler

Public Delegate Sub OnMessageReturnedHandler(sender As Object, e As AmqpclassicMessageReturnedEventArgs)

Public Class AmqpclassicMessageReturnedEventArgs Inherits EventArgs
  Public ReadOnly Property ChannelName As String
  Public ReadOnly Property ReplyCode As Integer
  Public ReadOnly Property ReplyText As String
  Public ReadOnly Property ExchangeName As String
  Public ReadOnly Property RoutingKey As String
End Class

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 property 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 component'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 .NET Edition - Version 20.0 [Build 8265]