File: //usr/local/lib/python3.9/site-packages/kombu/transport/__pycache__/zookeeper.cpython-39.pyc
a
X>h� � @ sd d Z ddlmZ ddlZddlZddlmZ ddlmZm Z ddl
mZmZ ddl
mZ z�ddlZdd lmZ dd
lmZ ejjejjejjejjejjejjejjejjejjf Zejjejj ejj!ejjejjejjejj"ejj#ejjejj$ejj%ejj&ejjejj'ej(fZ)W n e*�y2 dZd ZZ)Y n0 dZ+d
Z,G dd� dej-�Z-G dd� dej.�Z.dS )a� Zookeeper transport module for kombu.
Zookeeper based transport. This transport uses the built-in kazoo Zookeeper
based queue implementation.
**References**
- https://zookeeper.apache.org/doc/current/recipes.html#sc_recipes_Queues
- https://kazoo.readthedocs.io/en/latest/api/recipe/queue.html
**Limitations**
This queue does not offer reliable consumption. An entry is removed from
the queue prior to being processed. So if an error occurs, the consumer
has to re-queue the item or it will be lost.
Features
========
* Type: Virtual
* Supports Direct: Yes
* Supports Topic: Yes
* Supports Fanout: No
* Supports Priority: Yes
* Supports TTL: No
Connection String
=================
Connects to a zookeeper node as:
.. code-block::
zookeeper://SERVER:PORT/VHOST
The <vhost> becomes the base for all the other znodes. So we can use
it like a vhost.
Transport Options
=================
� )�annotationsN)�Empty)�bytes_to_str�ensure_bytes)�dumps�loads� )�virtual)�KazooClient)�Queue� i� z!Mahendra M <[email protected]>c s� e Zd ZdZdZi Z� fdd�Zdd� Zdd� Zd d
� Z dd� Z
d
d� Zdd� Zdd� Z
dd� Zdd� Zdd� Zedd� �Z� ZS )�ChannelzZookeeper Channel.Nc s4 t � j|fi |�� | jjj}d�|�d��| _d S )Nz/{}�/)�super�__init__�
connection�clientZvirtual_host�format�strip�_vhost)�selfr �kwargsZvhost�� __class__r �C/usr/local/lib/python3.9/site-packages/kombu/transport/zookeeper.pyr i s
zChannel.__init__c C s t j�| j|�S �N)�os�path�joinr )r �
queue_namer r r � _get_pathn s zChannel._get_pathc C s>