From 94485f28ace9e7cb92d314718c3719e099aa19fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Thu, 9 Jul 2020 19:02:23 +0200
Subject: [PATCH] improved declaration handling

---
 coolamqp/attaches/consumer.py | 2 +-
 coolamqp/attaches/declarer.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/coolamqp/attaches/consumer.py b/coolamqp/attaches/consumer.py
index a18e089..d5f0c14 100644
--- a/coolamqp/attaches/consumer.py
+++ b/coolamqp/attaches/consumer.py
@@ -384,7 +384,7 @@ class Consumer(Channeler):
         elif isinstance(payload, ExchangeDeclareOk):
             # Declare the queue
 
-            name = self.queue.name
+            name = b'' if self.queue.anonymous else self.queue.name
 
             self.connection.method_and_watch(
                 self.channel_id,
diff --git a/coolamqp/attaches/declarer.py b/coolamqp/attaches/declarer.py
index e81d786..084e542 100644
--- a/coolamqp/attaches/declarer.py
+++ b/coolamqp/attaches/declarer.py
@@ -140,6 +140,7 @@ class Operation(object):
         else:
             if isinstance(payload, QueueDeclareOk) and not self.obj.name:
                 self.obj.name = payload.queue
+                self.obj.anonymous = False
 
             self.span_finished()
             if self.fut is not None:
-- 
GitLab