Path: redb-route/redb.Route.RabbitMQ/RabbitMQUnroutableException.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.RabbitMQ/RabbitMQUnroutableException.cs ---- using RabbitMQ.Client.Exceptions; namespace redb.Route.RabbitMQ; /// /// A mandatory publish came back from the broker (basic.return): no queue takes it for its exchange and routing /// key, so it was not delivered. Every publish path throws it — an immediate send, a request-reply call and the sends /// of a transacted block — so one OnException<RabbitMQUnroutableException> covers all of them. /// public sealed class RabbitMQUnroutableException : Exception { /// Creates the exception for a returned publish. public RabbitMQUnroutableException( string message, string exchange, string routingKey, ushort replyCode, string replyText, Exception? innerException = null) : base(message, innerException) { Exchange = exchange; RoutingKey = routingKey; ReplyCode = replyCode; ReplyText = replyText; } /// The exchange the message was published to; empty for the default exchange. public string Exchange { get; } /// The routing key no queue is bound for. public string RoutingKey { get; } /// The broker's reply code, 312 (NO_ROUTE) for an unroutable message. public ushort ReplyCode { get; } /// The broker's reply text, such as NO_ROUTE. public string ReplyText { get; } /// Wraps the client's exception for a publish the broker returned. internal static RabbitMQUnroutableException From(PublishReturnException returned) => new( $"RabbitMQ: the message came back unroutable and was not delivered: no queue takes it for " + $"exchange='{returned.Exchange}', routingKey='{returned.RoutingKey}' ({returned.ReplyCode} {returned.ReplyText}).", returned.Exchange, returned.RoutingKey, returned.ReplyCode, returned.ReplyText, returned); }