Module: AceMQ::AMQP::PublishFailure Private

Defined in:
lib/acemq/amqp/transport.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The sentences a publish that did not arrive comes back with.

In one place because a batch has to raise exactly what a single publish raises: whoever greps a log for one of these should not have to know which of the two paths sent the message, and two copies of a sentence are two sentences waiting to drift apart.

Constant Summary collapse

UNSENT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

bunny's refusals that are raised before a frame reaches the socket: ConnectionClosedError from +send_frame+/+send_frameset+, which check open? and raise instead of writing, and ChannelAlreadyClosed from the first line of basic_publish. The same in bunny 2.24 and 3.x. By name, because bunny is loaded lazily and this file must load without it. Only ever asked of basic_publish: the same classes out of wait_for_confirms come after the write.

%w[Bunny::ConnectionClosedError Bunny::ChannelAlreadyClosed].freeze

Class Method Summary collapse

Class Method Details

.not_confirmed(message_id, exchange, routing_key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



82
83
84
85
# File 'lib/acemq/amqp/transport.rb', line 82

def not_confirmed(message_id, exchange, routing_key)
  "the broker would not confirm message #{message_id} on exchange " \
    "#{exchange.inspect} with key #{routing_key.inspect}"
end

.not_published(message_id, exchange, routing_key, reason) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



92
93
94
95
# File 'lib/acemq/amqp/transport.rb', line 92

def not_published(message_id, exchange, routing_key, reason)
  "cannot publish message #{message_id} to exchange #{exchange.inspect} " \
    "with key #{routing_key.inspect}: #{reason}"
end

.not_routed(message_id, exchange, routing_key, reason) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



87
88
89
90
# File 'lib/acemq/amqp/transport.rb', line 87

def not_routed(message_id, exchange, routing_key, reason)
  "the broker had nowhere to route message #{message_id} published to exchange " \
    "#{exchange.inspect} with key #{routing_key.inspect}: #{reason}"
end

.paused(message_id, exchange, routing_key, reason) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



97
98
99
100
101
102
# File 'lib/acemq/amqp/transport.rb', line 97

def paused(message_id, exchange, routing_key, reason)
  not_published(message_id, exchange, routing_key,
                "the broker has blocked this connection (#{reason}), so the message " \
                "was not sent. This is broker capacity, not this message: send it " \
                "again once the block clears.")
end

.unsent(message_id, exchange, routing_key, error) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



115
116
117
118
119
120
# File 'lib/acemq/amqp/transport.rb', line 115

def unsent(message_id, exchange, routing_key, error)
  not_published(message_id, exchange, routing_key,
                "bunny would not write it because the connection or channel is " \
                "closed (#{error.class.name}), so the message was not sent. Send it " \
                "again once the connection is recovered.")
end

.unsent?(error) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


113
# File 'lib/acemq/amqp/transport.rb', line 113

def unsent?(error) = UNSENT.include?(error.class.name)