Add constants to __all__, update function to return a bound queue on
success.
@@ -37,7 +37,10 @@ from st2common.transport import reactor
LOG = logging.getLogger('st2common.transport.bootstrap')
__all__ = [
- 'register_exchanges'
+ 'register_exchanges',
+
+ 'EXCHANGES',
+ 'QUEUES'
]
# List of exchanges which are pre-declared on service set up.
@@ -92,6 +95,8 @@ def _do_register_exchange(exchange, connection, channel, retry_wrapper):
def _do_predeclare_queue(channel, queue):
LOG.debug('Predeclaring queue for exchange "%s"' % (queue.exchange.name))
+ bound_queue = None
+
try:
bound_queue = queue(channel)
bound_queue.declare(nowait=False)
@@ -99,6 +104,8 @@ def _do_predeclare_queue(channel, queue):
except Exception:
LOG.exception('Failed to predeclare queue for exchange "%s"' % (queue.exchange.name))
+ return bound_queue
+
def register_exchanges():
LOG.debug('Registering exchanges...')
