mirror of https://github.com/celery/kombu.git
Virtual: Emits an UndeliverableWarning if the message ends up in the deadletter queue
This commit is contained in:
parent
850d79dbc9
commit
114094d936
|
@ -12,6 +12,7 @@ Emulates the AMQ API for non-AMQ transports.
|
|||
"""
|
||||
import base64
|
||||
import socket
|
||||
import warnings
|
||||
|
||||
from itertools import count
|
||||
from time import sleep, time
|
||||
|
@ -27,6 +28,11 @@ from kombu.utils.finalize import Finalize
|
|||
from kombu.transport.virtual.scheduling import FairCycle
|
||||
from kombu.transport.virtual.exchange import STANDARD_EXCHANGE_TYPES
|
||||
|
||||
UNDELIVERABLE_FMT = """\
|
||||
Message could not be delivered: No queues bound to exchange %(exchange)r
|
||||
with binding key %(routing_key)r
|
||||
"""
|
||||
|
||||
|
||||
class Base64(object):
|
||||
|
||||
|
@ -42,6 +48,11 @@ class NotEquivalentError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class UndeliverableWarning(UserWarning):
|
||||
"""The message could not be delivered to a queue."""
|
||||
pass
|
||||
|
||||
|
||||
class BrokerState(object):
|
||||
|
||||
#: exchange declarations.
|
||||
|
@ -501,6 +512,8 @@ class Channel(AbstractChannel, base.StdChannel):
|
|||
return self.typeof(exchange).lookup(self.get_table(exchange),
|
||||
exchange, routing_key, default)
|
||||
except KeyError:
|
||||
warnings.warn(UndeliverableWarning(UNDELIVERABLE_FMT % {
|
||||
"exchange": exchange, "routing_key": routing_key}))
|
||||
self._new_queue(default)
|
||||
return [default]
|
||||
|
||||
|
|
Loading…
Reference in New Issue