當前位置: 首頁>>代碼示例>>Python>>正文


Python Connection.attach方法代碼示例

本文整理匯總了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()
開發者ID:splice,項目名稱:gofer,代碼行數:27,代碼來源:broker.py

示例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()
開發者ID:AndreaGiardini,項目名稱:pulp,代碼行數:43,代碼來源:0009_qpid_queues.py

示例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()
開發者ID:BrnoPCmaniak,項目名稱:pulp,代碼行數:43,代碼來源:0009_qpid_queues.py


注:本文中的qpid.messaging.Connection.attach方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。