ԆEWz d dl mZ d dlZd dlmZmZmZmZmZm Z d dl mZ d dlm Z d dlmZ erd dlmZ dZd Z G d d Z G d d ZdS ) )annotationsN) TYPE_CHECKING AsyncIterator AwaitableCallableListOptional)uuid4)errors)Msg)JetStreamContexti i c e Zd ZdZddddddeefd'dZed(d Zed(d Z ed)d Z ed*d Zed*d Zed*d Z d+d,dZd Zd! Zd-d"Zd.d/d$Zd-d%Zd-d&ZdS )0Subscriptiona A Subscription represents interest in a particular subject. A Subscription should not be constructed directly, rather `connection.subscribe()` should be used to get a subscription. :: nc = await nats.connect() # Async Subscription async def cb(msg): print('Received', msg) await nc.subscribe('foo', cb=cb) # Sync Subscription sub = nc.subscribe('foo') msg = await sub.next_msg() print('Received', msg) r Nidintsubjectstrqueuecb*Optional[Callable[[Msg], Awaitable[None]]]futureOptional[asyncio.Future]max_msgspending_msgs_limitpending_bytes_limitreturnNonec . || _ || _ || _ || _ || _ d| _ || _ || _ d| _ || _ | | _ t j | | _ |i | _ nd | _ d| _ d | _ d | _ d | _ d S )Nr F)maxsize)_conn_id_subject_queue _max_msgs _received_cb_future_closed_pending_msgs_limit_pending_bytes_limitasyncioQueue_pending_queue_pending_next_msgs_calls _pending_size_wait_for_msgs_task_message_iterator_jsi) selfconnr r r r r r r r s u/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/nats/aio/subscription.py__init__zSubscription.__init__? s ! $6 $7!29-HZ2[2[2[ :,.D)),0D)#' !% 6: c | j S )z< Returns the subject of the `Subscription`. )r# r4 s r6 r zSubscription.subjectf s }r8 c | j S )zX Returns the queue name of the `Subscription` if part of a queue group. )r$ r: s r6 r zSubscription.queuem s {r8 AsyncIterator[Msg]c F | j st j d | j S )a Retrieves an async iterator for the messages from the subscription. This is only available if a callback isn't provided when creating a subscription. :: nc = await nats.connect() sub = await nc.subscribe('foo') # Use `async for` which implicitly awaits messages async for msg in sub.messages: print('Received', msg) zCcannot iterate over messages with a non iteration subscription type)r2 r Errorr: s r6 messageszSubscription.messagest s* % f,deee%%r8 c 4 | j S )zw Number of delivered messages by the NATS Server that are being buffered in the pending queue. )r. qsizer: s r6 pending_msgszSubscription.pending_msgs s "((***r8 c | j S )zk Size of data sent by the NATS Server that is being buffered in the pending queue. )r0 r: s r6 pending_byteszSubscription.pending_bytes s !!r8 c | j S )zK Number of delivered messages to this subscription so far. )r&