diff options
author | Mehdi Abaakouk <sileht@redhat.com> | 2015-12-09 18:49:19 +0100 |
---|---|---|
committer | Mehdi Abaakouk <sileht@redhat.com> | 2015-12-10 07:40:26 +0100 |
commit | 8093aefaae695bc4407b451f8863ed1137a0e022 (patch) | |
tree | 0c32ded74d45b4df9d16315af776ad5aae5b5b3d | |
parent | 53256e990d3632e0120e9a10ede1de9b3b2c9a0a (diff) | |
download | oslo-messaging-8093aefaae695bc4407b451f8863ed1137a0e022.tar.gz |
Don't trigger error_callback for known exc
When AMQPDestinationNotFound is raised, we must not
call the error_callback method. The exception is logged
only if needed in upper layer (amqpdriver.py).
Related-bug: #1524418
Related-bug: #1521958
(cherry picked from commit Ic1ddec2d13172532dbaa572d04a4c22c97ac4fe7)
Change-Id: I4bc323f0b9578cfd4972f882d6fbf59b9064ca53
-rw-r--r-- | oslo_messaging/_drivers/amqp.py | 4 | ||||
-rw-r--r-- | oslo_messaging/_drivers/impl_rabbit.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/oslo_messaging/_drivers/amqp.py b/oslo_messaging/_drivers/amqp.py index 0b8cafa..24c4d32 100644 --- a/oslo_messaging/_drivers/amqp.py +++ b/oslo_messaging/_drivers/amqp.py @@ -256,3 +256,7 @@ def _add_unique_id(msg): unique_id = uuid.uuid4().hex msg.update({UNIQUE_ID: unique_id}) LOG.debug('UNIQUE_ID is %s.', unique_id) + + +class AMQPDestinationNotFound(Exception): + pass diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 8e16a28..78b308d 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -878,6 +878,10 @@ class Connection(object): 'retry': retry} LOG.error(msg) raise exceptions.MessageDeliveryFailure(msg) + except rpc_amqp.AMQPDestinationNotFound: + # NOTE(sileht): we must reraise this without + # trigger error_callback + raise except Exception as exc: error_callback and error_callback(exc) raise |