Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/kombu/transport/__pycache__/qpid.cpython-39.pyc
Ðазад
a o�h � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl m Z ddlmZ ddl mZ ddlZzddlZW n ey� dZY n0 zddlZW n ey� dZY n0 z,ddlmZ ddlmZ ddlmZmZ W n$ e�y dZdZdZdZY n0 zddlZW n e�y* dZY n0 dd lmZ dd lmZmZ ddlm Z m!Z! ee"�Z#ze$ W n e%�y� e&Z$Y n0 dZ'd Z(d�)e*e+e(��Z,dd� Z-G dd� de.�Z/G dd� d�Z0G dd� dej1�Z2G dd� d�Z3G dd� dej4�Z4dS )a� Qpid Transport module for kombu. `Qpid`_ transport using `qpid-python`_ as the client and `qpid-tools`_ for broker management. The use this transport you must install the necessary dependencies. These dependencies are available via PyPI and can be installed using the pip command: .. code-block:: console $ pip install kombu[qpid] or to install the requirements manually: .. code-block:: console $ pip install qpid-tools qpid-python .. admonition:: Python 3 and PyPy Limitations The Qpid transport does not support Python 3 or PyPy environments due to underlying dependencies not being compatible. This version is tested and works with with Python 2.7. .. _`Qpid`: https://qpid.apache.org/ .. _`qpid-python`: https://pypi.org/project/qpid-python/ .. _`qpid-tools`: https://pypi.org/project/qpid-tools/ Features ======== * Type: Native * Supports Direct: Yes * Supports Topic: Yes * Supports Fanout: Yes * Supports Priority: Yes * Supports TTL: Yes Authentication ============== This transport supports SASL authentication with the Qpid broker. Normally, SASL mechanisms are negotiated from a client list and a server list of possible mechanisms, but in practice, different SASL client libraries give different behaviors. These different behaviors cause the expected SASL mechanism to not be selected in many cases. As such, this transport restricts the mechanism types based on Kombu's configuration according to the following table. +------------------------------------+--------------------+ | **Broker String** | **SASL Mechanism** | +------------------------------------+--------------------+ | qpid://hostname/ | ANONYMOUS | +------------------------------------+--------------------+ | qpid://username:password@hostname/ | PLAIN | +------------------------------------+--------------------+ | see instructions below | EXTERNAL | +------------------------------------+--------------------+ The user can override the above SASL selection behaviors and specify the SASL string using the :attr:`~kombu.Connection.login_method` argument to the :class:`~kombu.Connection` object. The string can be a single SASL mechanism or a space separated list of SASL mechanisms. If you are using Celery with Kombu, this can be accomplished by setting the *BROKER_LOGIN_METHOD* Celery option. .. note:: While using SSL, Qpid users may want to override the SASL mechanism to use *EXTERNAL*. In that case, Qpid requires a username to be presented that matches the *CN* of the SSL client certificate. Ensure that the broker string contains the corresponding username. For example, if the client certificate has *CN=asdf* and the client connects to *example.com* on port 5671, the broker string should be: **qpid://asdf@example.com:5671/** Transport Options ================= The :attr:`~kombu.Connection.transport_options` argument to the :class:`~kombu.Connection` object are passed directly to the :class:`qpid.messaging.endpoints.Connection` as keyword arguments. These options override and replace any other default or specified values. If using Celery, this can be accomplished by setting the *BROKER_TRANSPORT_OPTIONS* Celery option. � )�annotationsN)�gettext)�Empty)� monotonic)�ConnectionError)�NotFound� SessionClosed)� get_logger)�base�virtual)�Base64�Messagezobject already exists)� r r �.c C s | du S )a Return True if the dependency is None, otherwise False. This is done using a function so that tests can mock this behavior easily. :param dependency: The module to check if it is None :return: True if dependency is None otherwise False. N� )� dependencyr r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/kombu/transport/qpid.py�dependency_is_none� s r c @ s e Zd ZdZdS )�AuthenticationFailurezCannot authenticate with Qpid.N)�__name__� __module__�__qualname__�__doc__r r r r r � s r c @ sL e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z ddd�Z dS )�QoSa� A helper object for message prefetch and ACKing purposes. :keyword prefetch_count: Initial prefetch count, hard set to 1. :type prefetch_count: int NOTE: prefetch_count is currently hard set to 1, and needs to be improved This object is instantiated 1-for-1 with a :class:`~.kombu.transport.qpid.Channel` instance. QoS allows ``prefetch_count`` to be set to the number of outstanding messages the corresponding :class:`~kombu.transport.qpid.Channel` should be allowed to prefetch. Setting ``prefetch_count`` to 0 disables prefetch limits, and the object can hold an arbitrary number of messages. Messages are added using :meth:`append`, which are held until they are ACKed asynchronously through a call to :meth:`ack`. Messages that are received, but not ACKed will not be delivered by the broker to another consumer until an ACK is received, or the session is closed. Messages are referred to using delivery_tag, which are unique per :class:`Channel`. Delivery tags are managed outside of this object and are passed in with a message to :meth:`append`. Un-ACKed messages can be looked up from QoS using :meth:`get` and can be rejected and forgotten using :meth:`reject`. r c C s || _ d| _i | _d S )Nr )�session�prefetch_count�_not_yet_acked)�selfr r r r r �__init__� s zQoS.__init__c C s | j pt| j�| j k S )au Return True if the :class:`Channel` can consume more messages. Used to ensure the client adheres to currently active prefetch limits. :returns: True, if this QoS object can accept more messages without violating the prefetch_count. If prefetch_count is 0, can_consume will always return True. :rtype: bool �r �lenr �r r r r �can_consume� s �zQoS.can_consumec C s | j s dS | j t| j� S )a� Return the remaining message capacity. Returns an estimated number of outstanding messages that a :class:`kombu.transport.qpid.Channel` can accept without exceeding ``prefetch_count``. If ``prefetch_count`` is 0, then this method returns 1. :returns: The number of estimated messages that can be fetched without violating the prefetch_count. :rtype: int r r r! r r r �can_consume_max_estimate� s �zQoS.can_consume_max_estimatec C s || j |<