diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ff17a4d93fdbefd5c45186892689f2ee0319e75..e4ce135ce8382ba8d2689c73bc45077342a9a870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Since v1.3.2 they'll be put here and in release description. # v1.4.2 ======== +* fixed and unit tested the topic exchanges +* fixed declare documentation + +# v1.4.2 +======== + * added docs regarding consume method. * added testing topic exchanges diff --git a/coolamqp/__init__.py b/coolamqp/__init__.py index 369aa3f9486ba977708f50f64d75241e7e32445d..98d186bed77bc42035034a28f4198f152a63158a 100644 --- a/coolamqp/__init__.py +++ b/coolamqp/__init__.py @@ -1 +1 @@ -__version__ = '1.4.2a2' +__version__ = '1.4.2' diff --git a/coolamqp/clustering/cluster.py b/coolamqp/clustering/cluster.py index 6a8432d2fa841c08dfa3480f3dcceed0613ecfc8..80e5864427bd68f5c2b5988631489b7cc8e639ea 100644 --- a/coolamqp/clustering/cluster.py +++ b/coolamqp/clustering/cluster.py @@ -121,6 +121,9 @@ class Cluster(object): """ Declare a Queue/Exchange. + .. note:: Note that if your queue relates to an exchange that has not yet been declared you'll be faced with + AMQP error 404: NOT_FOUND, so try to declare your exchanges before your queues. + :param obj: Queue/Exchange object :param persistent: should it be redefined upon reconnect? :param span: optional parent span, if opentracing is installed diff --git a/tests/test_clustering/test_topic_exchanges.py b/tests/test_clustering/test_topic_exchanges.py index 8959ad5980b74037867f2fffd89193d9398aa00e..067db55ca1c46a7d105d613b182ad95df5500e6c 100644 --- a/tests/test_clustering/test_topic_exchanges.py +++ b/tests/test_clustering/test_topic_exchanges.py @@ -9,7 +9,7 @@ from coolamqp.clustering import Cluster from coolamqp.objects import Exchange, Queue, NodeDefinition, Message -XCHG = Exchange('topic', type='topic', durable=True) +XCHG = Exchange('smok5.results', type='topic', durable=True) QUEUE = Queue(exchange=XCHG, exclusive=True, auto_delete=True) @@ -23,12 +23,16 @@ class TestTopic(unittest.TestCase): self.c.start() def tearDown(self): + try: + self.cons.cancel().result() + except AttributeError: + pass self.c.shutdown() - def test_bind_stuff(self): + self.c.declare(XCHG).result() self.c.declare(QUEUE).result() - self.c.bind(QUEUE, XCHG, routing_key='hello-world') + self.c.bind(QUEUE, XCHG, routing_key='hello-world').result() did_receive = False @@ -37,7 +41,7 @@ class TestTopic(unittest.TestCase): did_receive = True msg.ack() - cons, fut = self.c.consume(QUEUE, on_message=do, no_ack=False) + self.cons, fut = self.c.consume(QUEUE, on_message=do, no_ack=False) fut.result() self.c.publish(Message(b'good boy'), exchange=XCHG, routing_key='hello-world') @@ -48,4 +52,7 @@ class TestTopic(unittest.TestCase): if monotonic.monotonic() - start > 10: self.fail("Message not received within 10 seconds") - self.cons.cancel.result() + did_receive = False + self.c.publish(Message(b'good boy', exchange=XCHG, routing_key='helloworld'), confirm=True).result() + time.sleep(5) + self.assertFalse(did_receive)