Created
September 11, 2015 17:54
-
-
Save csarcom/95147af210468f5b68d8 to your computer and use it in GitHub Desktop.
komby enforce bind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _create_exchange(self): | |
return kombu.Exchange(self._amqp_exchange_name, type='direct', | |
durable=True, auto_delete=False) | |
def _create_queue(self, exchange): | |
return kombu.Queue(self._queue_name, auto_delete=False) | |
def _enforce_bind(self): | |
with kombu.Connection(host) as connection: | |
exchange = self._create_exchange()(connection) | |
exchange.declare() | |
self._queue = self._create_queue(exchange)(connection) | |
self._queue.declare() | |
for routing_key in self._routing_keys: | |
self._queue.bind_to(exchange, routing_key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment