Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/kombu/transport/__pycache__/filesystem.cpython-39.pyc
Ðазад
a o�h�( � @ sz d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl m Z ddlmZ ddl mZ ddlmZ dd lmZ dd lmZmZ ddlmZmZ ddlmZ d Zd�eee��Zej dk�rddl!Z!ddl"Z"ddl#Z#e"j$Z%dZ&e"j'Z(e!�)� Z*dd� Z+dd� Z,n>ej dk�r<ddl-Z-ddl-m%Z%m&Z& dd� Z+dd� Z,ne.d��edg d��Z/G dd� dej0�Z0G dd� dej1�Z1dS )a� File-system Transport module for kombu. Transport using the file-system as the message store. Messages written to the queue are stored in `data_folder_in` directory and messages read from the queue are read from `data_folder_out` directory. Both directories must be created manually. Simple example: * Producer: .. code-block:: python import kombu conn = kombu.Connection( 'filesystem://', transport_options={ 'data_folder_in': 'data_in', 'data_folder_out': 'data_out' } ) conn.connect() test_queue = kombu.Queue('test', routing_key='test') with conn as conn: with conn.default_channel as channel: producer = kombu.Producer(channel) producer.publish( {'hello': 'world'}, retry=True, exchange=test_queue.exchange, routing_key=test_queue.routing_key, declare=[test_queue], serializer='pickle' ) * Consumer: .. code-block:: python import kombu conn = kombu.Connection( 'filesystem://', transport_options={ 'data_folder_in': 'data_out', 'data_folder_out': 'data_in' } ) conn.connect() def callback(body, message): print(body, message) message.ack() test_queue = kombu.Queue('test', routing_key='test') with conn as conn: with conn.default_channel as channel: consumer = kombu.Consumer( conn, [test_queue], accept=['pickle'] ) consumer.register_callback(callback) with consumer: conn.drain_events(timeout=1) Features ======== * Type: Virtual * Supports Direct: Yes * Supports Topic: Yes * Supports Fanout: Yes * Supports Priority: No * Supports TTL: No Connection String ================= Connection string is in the following format: .. code-block:: filesystem:// Transport Options ================= * ``data_folder_in`` - directory where are messages stored when written to queue. * ``data_folder_out`` - directory from which are messages read when read from queue. * ``store_processed`` - if set to True, all processed messages are backed up to ``processed_folder``. * ``processed_folder`` - directory where are backed up processed files. * ``control_folder`` - directory where are exchange-queue table stored. � )�annotationsN)� namedtuple)�Path)�Empty)� monotonic)�ChannelError)�virtual)�bytes_to_str�str_to_bytes)�dumps�loads)�cached_property)� r r �.�ntc C s$ t �| �� �}t �||ddt� dS )�Create file lock.r � � N)� win32file�_get_osfhandle�filenoZ LockFileEx�__overlapped)�file�flags�hfile� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/kombu/transport/filesystem.py�lock} s r c C s"