Exception: BugBunny::PublishUnroutable
- Defined in:
- lib/bug_bunny/exception.rb
Overview
Error lanzado cuando el broker retorna un mensaje publicado con ‘mandatory: true` que no pudo rutearse a ninguna cola en modo `:confirmed`.
Un return implica que el publish llegó al broker pero ninguna binding aceptó la routing key — el mensaje se considera no entregado desde la perspectiva del publisher. Espejo simétrico de PublishNacked pero para la señal ‘basic.return` en lugar de `basic.nack`.
Se levanta por default desde BugBunny::Producer#confirmed cuando el request tiene ‘mandatory: true`. Para opt-out, configurar `BugBunny.configuration.return_raise = false` o pasar `return_raise: false` por request. El callback `BugBunny.configuration.on_return` se sigue invocando antes del raise (orden: registro interno → user_cb → raise en el caller).
Instance Attribute Summary collapse
-
#correlation_id ⇒ String?
readonly
Correlation ID del request retornado.
-
#exchange ⇒ String
readonly
Nombre del exchange destino.
-
#path ⇒ String
readonly
Ruta lógica del request cuyo publish fue retornado.
-
#reply_code ⇒ Integer?
readonly
Código AMQP de la razón (ej: 312 = NO_ROUTE).
-
#reply_text ⇒ String?
readonly
Texto humano-legible que describe la razón.
-
#routing_key ⇒ String
readonly
Routing key utilizada en el publish.
Instance Method Summary collapse
-
#initialize(path:, exchange:, routing_key:, reply_code: nil, reply_text: nil, correlation_id: nil) ⇒ PublishUnroutable
constructor
rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(path:, exchange:, routing_key:, reply_code: nil, reply_text: nil, correlation_id: nil) ⇒ PublishUnroutable
rubocop:disable Metrics/ParameterLists
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/bug_bunny/exception.rb', line 101 def initialize(path:, exchange:, routing_key:, reply_code: nil, reply_text: nil, correlation_id: nil) @path = path @exchange = exchange @routing_key = routing_key @reply_code = reply_code @reply_text = reply_text @correlation_id = correlation_id super("broker returned unroutable message on path=#{path} exchange=#{exchange} " \ "routing_key=#{routing_key} reply_code=#{reply_code} reply_text=#{reply_text}") end |
Instance Attribute Details
#correlation_id ⇒ String? (readonly)
Returns Correlation ID del request retornado.
92 93 94 |
# File 'lib/bug_bunny/exception.rb', line 92 def correlation_id @correlation_id end |
#exchange ⇒ String (readonly)
Returns Nombre del exchange destino.
80 81 82 |
# File 'lib/bug_bunny/exception.rb', line 80 def exchange @exchange end |
#path ⇒ String (readonly)
Returns Ruta lógica del request cuyo publish fue retornado.
77 78 79 |
# File 'lib/bug_bunny/exception.rb', line 77 def path @path end |
#reply_code ⇒ Integer? (readonly)
Returns Código AMQP de la razón (ej: 312 = NO_ROUTE).
86 87 88 |
# File 'lib/bug_bunny/exception.rb', line 86 def reply_code @reply_code end |
#reply_text ⇒ String? (readonly)
Returns Texto humano-legible que describe la razón.
89 90 91 |
# File 'lib/bug_bunny/exception.rb', line 89 def reply_text @reply_text end |
#routing_key ⇒ String (readonly)
Returns Routing key utilizada en el publish.
83 84 85 |
# File 'lib/bug_bunny/exception.rb', line 83 def routing_key @routing_key end |