Skip to content
Snippets Groups Projects

Fixes #4

Merged Piotr Maślanka requested to merge feature-#4 into milestone-2.0.0
Files
5
@@ -89,6 +89,7 @@ class Cluster(object):
self.pub_tr = None # type: Publisher
self.pub_na = None # type: Publisher
self.decl = None # type: Declarer
self.on_fail = None
if on_fail is not None:
def decorated():
@@ -96,10 +97,8 @@ class Cluster(object):
on_fail()
self.on_fail = decorated
else:
self.on_fail = None
def bind(self, queue, exchange, routing_key, persistent=False, span=None,
def bind(self, queue, exchange, routing_key, span=None,
dont_trace=False, arguments=None):
"""
Bind a queue to an exchange
@@ -114,12 +113,10 @@ class Cluster(object):
else:
child_span = None
fut = self.decl.declare(QueueBind(queue, exchange, routing_key, arguments),
persistent=persistent,
span=child_span)
return close_future(fut, child_span)
def declare(self, obj, # type: tp.Union[Queue, Exchange]
persistent=False, # type: bool
span=None, # type: tp.Optional[opentracing.Span]
dont_trace=False # type: bool
): # type: (...) -> concurrent.futures.Future
@@ -132,7 +129,6 @@ class Cluster(object):
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
:param dont_trace: if True, a span won't be output
:return: Future
@@ -144,7 +140,7 @@ class Cluster(object):
child_span = self._make_span('declare', span)
else:
child_span = None
fut = self.decl.declare(obj, persistent=persistent, span=child_span)
fut = self.decl.declare(obj, span=child_span)
return close_future(fut, child_span)
def drain(self, timeout, span=None, dont_trace=False): # type: (float) -> Event
@@ -329,7 +325,6 @@ class Cluster(object):
self.attache_group.add(self.pub_tr)
self.attache_group.add(self.pub_na)
self.attache_group.add(self.decl)
self.listener.init()
self.listener.start()
@@ -371,3 +366,9 @@ class Cluster(object):
self.listener.terminate()
if wait:
self.listener.join()
def is_shutdown(self):
"""
:return: bool, if this was started and later disconnected.
"""
return self.started and not self.connected
Loading