diff options
author | Davanum Srinivas <davanum@gmail.com> | 2015-11-29 18:26:32 -0500 |
---|---|---|
committer | Davanum Srinivas (dims) <davanum@gmail.com> | 2015-11-30 11:53:48 +0000 |
commit | 357dcb75abdfe1fc78e034d1913f478357cde18f (patch) | |
tree | d67024951774cd1281ce311bb67c574ebd75265f /oslo_messaging/_drivers/amqpdriver.py | |
parent | 887b9482afe728a0d527dc14f66163474b5f852c (diff) | |
download | oslo-messaging-357dcb75abdfe1fc78e034d1913f478357cde18f.tar.gz |
Move ConnectionPool and ConnectionContext outside amqp.py
ConnectionPool and ConnectionContext can be used by other
drivers (like Kafka) and hence should be outside of amqp.py.
* Moving ConnectionPool to pool.py
* Moving ConnectionContext to common.py
* Moving a couple of global variables to common.py
No other logic changes, just refactoring
Change-Id: I85154509a361690426772ef116590d38a965ca8d
Diffstat (limited to 'oslo_messaging/_drivers/amqpdriver.py')
-rw-r--r-- | oslo_messaging/_drivers/amqpdriver.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/oslo_messaging/_drivers/amqpdriver.py b/oslo_messaging/_drivers/amqpdriver.py index d340508..420587c 100644 --- a/oslo_messaging/_drivers/amqpdriver.py +++ b/oslo_messaging/_drivers/amqpdriver.py @@ -100,7 +100,7 @@ class AMQPIncomingMessage(base.IncomingMessage): return with self.listener.driver._get_connection( - rpc_amqp.PURPOSE_SEND) as conn: + rpc_common.PURPOSE_SEND) as conn: if self.listener.driver.send_single_reply: self._send_reply(conn, reply, failure, log_failure=log_failure, ending=True) @@ -366,9 +366,9 @@ class AMQPDriverBase(base.BaseDriver): def _get_exchange(self, target): return target.exchange or self._default_exchange - def _get_connection(self, purpose=rpc_amqp.PURPOSE_SEND): - return rpc_amqp.ConnectionContext(self._connection_pool, - purpose=purpose) + def _get_connection(self, purpose=rpc_common.PURPOSE_SEND): + return rpc_common.ConnectionContext(self._connection_pool, + purpose=purpose) def _get_reply_q(self): with self._reply_q_lock: @@ -377,7 +377,7 @@ class AMQPDriverBase(base.BaseDriver): reply_q = 'reply_' + uuid.uuid4().hex - conn = self._get_connection(rpc_amqp.PURPOSE_LISTEN) + conn = self._get_connection(rpc_common.PURPOSE_LISTEN) self._waiter = ReplyWaiter(reply_q, conn, self._allowed_remote_exmods) @@ -422,7 +422,7 @@ class AMQPDriverBase(base.BaseDriver): log_msg = "CAST unique_id: %s " % unique_id try: - with self._get_connection(rpc_amqp.PURPOSE_SEND) as conn: + with self._get_connection(rpc_common.PURPOSE_SEND) as conn: if notify: exchange = self._get_exchange(target) log_msg += "NOTIFY exchange '%(exchange)s'" \ @@ -468,7 +468,7 @@ class AMQPDriverBase(base.BaseDriver): envelope=(version == 2.0), notify=True, retry=retry) def listen(self, target): - conn = self._get_connection(rpc_amqp.PURPOSE_LISTEN) + conn = self._get_connection(rpc_common.PURPOSE_LISTEN) listener = AMQPListener(self, conn) @@ -484,7 +484,7 @@ class AMQPDriverBase(base.BaseDriver): return listener def listen_for_notifications(self, targets_and_priorities, pool): - conn = self._get_connection(rpc_amqp.PURPOSE_LISTEN) + conn = self._get_connection(rpc_common.PURPOSE_LISTEN) listener = AMQPListener(self, conn) for target, priority in targets_and_priorities: |