diff --git a/coolamqp/attaches/consumer.py b/coolamqp/attaches/consumer.py index f0da62eead8850d1f49476df4cf57e6bc230454a..c6f208766aef424ea3af85674112780a636498a5 100644 --- a/coolamqp/attaches/consumer.py +++ b/coolamqp/attaches/consumer.py @@ -249,7 +249,7 @@ class Consumer(Channeler): self.connection.method_and_watch( self.channel_id, ExchangeDeclare(self.queue.exchange.name.encode('utf8'), - self.queue.exchange.type.encode('utf8'), + self.queue.exchange.type, False, self.queue.exchange.durable, self.queue.exchange.auto_delete, diff --git a/coolamqp/objects.py b/coolamqp/objects.py index 9f8635954a8c031420e3d2b586f9861f999f432c..4cb5f978a981ad1a7467b282df799d4977d46038 100644 --- a/coolamqp/objects.py +++ b/coolamqp/objects.py @@ -126,9 +126,11 @@ class Exchange(object): direct = None # the direct exchange - def __init__(self, name=u'', type='direct', durable=True, auto_delete=False): + def __init__(self, name=u'', type=b'direct', durable=True, auto_delete=False): self.name = name - self.type = type + if isinstance(type, six.text_type): + type = type.encode('utf8') + self.type = type # must be bytes self.durable = durable self.auto_delete = auto_delete