本文整理汇总了Python中qpid.messaging.Connection.attach方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.attach方法的具体用法?Python Connection.attach怎么用?Python Connection.attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qpid.messaging.Connection
的用法示例。
在下文中一共展示了Connection.attach方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect
# 需要导入模块: from qpid.messaging import Connection [as 别名]
# 或者: from qpid.messaging.Connection import attach [as 别名]
def connect(self):
"""
Connect to the broker.
@return: The AMQP connection object.
@rtype: I{Connection}
"""
self.__lock()
try:
if self.connection is None:
url = self.url.simple()
transport = self.url.transport
log.info('connecting:\n%s', self)
con = Connection(
url=url,
tcp_nodelay=True,
reconnect=True,
transport=transport)
con.attach()
log.info('{%s} connected to AMQP', self.id())
self.connection = con
else:
con = self.connection
return con
finally:
self.__unlock()
示例2: migrate
# 需要导入模块: from qpid.messaging import Connection [as 别名]
# 或者: from qpid.messaging.Connection import attach [as 别名]
def migrate(*args, **kwargs):
"""
Migrate qpid queues:
- Ensure pulp.task is no longer *exclusive*.
- Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
"""
transport = pulp_conf.get('messaging', 'transport')
if transport != 'qpid':
# not using qpid
return
if not QPID_MESSAGING_AVAILABLE:
msg = _('Migration 0009 did not run because the python package qpid.messaging is not '
'installed. Please install qpid.messaging and rerun the migrations. See %s'
'for more information.')
msg = msg % QPID_MESSAGING_URL
_logger.error(msg)
raise Exception(msg)
if not QPIDTOOLLIBS_AVAILABLE:
msg = _('Migration 0009 did not run because the python package qpidtoollibs is not '
'installed. Please install qpidtoollibs and rerun the migrations. See %s for more '
'information.')
msg = msg % QPIDTOOLLIBS_URL
_logger.error(msg)
raise Exception(msg)
url = urlparse(pulp_conf.get('messaging', 'url'))
connection = Connection(
host=url.hostname,
port=url.port,
transport=url.scheme,
reconnect=False,
ssl_certfile=pulp_conf.get('messaging', 'clientcert'),
ssl_skip_hostname_check=True)
connection.attach()
broker = BrokerAgent(connection)
_migrate_reply_queue(broker)
_migrate_agent_queues(broker)
connection.detach()
示例3: migrate
# 需要导入模块: from qpid.messaging import Connection [as 别名]
# 或者: from qpid.messaging.Connection import attach [as 别名]
def migrate(*args, **kwargs):
"""
Migrate qpid queues:
- Ensure pulp.task is no longer *exclusive*.
- Rename agent queues: consumer_id> => pulp.agent.<consumer_id>
"""
transport = pulp_conf.get('messaging', 'transport')
if transport != 'qpid':
# not using qpid
return
if not QPID_MESSAGING_AVAILABLE:
msg = _('Migration 0009 did not run because the python package qpid.messaging is not '
'installed. Pulp\'s Qpid client dependencies can be installed with the '
'\"pulp-server-qpid\" package group. See the installation docs for more '
'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.')
_logger.error(msg)
raise Exception(msg)
if not QPIDTOOLLIBS_AVAILABLE:
msg = _('Migration 0009 did not run because the python package qpidtoollibs is not '
'installed. Pulp\'s Qpid client dependencies can be installed with the '
'\"pulp-server-qpid\" package group. See the installation docs for more '
'information. Alternatively, you may reconfigure Pulp to use RabbitMQ.')
_logger.error(msg)
raise Exception(msg)
url = urlparse(pulp_conf.get('messaging', 'url'))
connection = Connection(
host=url.hostname,
port=url.port,
transport=url.scheme,
reconnect=False,
ssl_certfile=pulp_conf.get('messaging', 'clientcert'),
ssl_skip_hostname_check=True)
connection.attach()
broker = BrokerAgent(connection)
_migrate_reply_queue(broker)
_migrate_agent_queues(broker)
connection.detach()