
                             S SK Jr  S SKJrJrJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJrJrJr  S SKJ r   S SK!J"r"  S SK#J$r$J%r%J&r&   " S S\\ 5      r' " S S\\ 5      r(g)    )ThreadPoolExecutor)OptionalUnionSetAsyncIterator)ClientOptions)Credentials)StreamingPullFuture)Message)ReassignmentHandlermake_async_subscriber) MultiplexedAsyncSubscriberClient)MultiplexedSubscriberClient)MessageTransformer)NackHandler)SubscriberClientInterfaceAsyncSubscriberClientInterfaceMessageCallback)ConstructableFromServiceAccount)RequireStarted)FlowControlSettings	PartitionSubscriptionPathc                       \ rS rSr% Sr\\S'   \\S'   SSSSSSSS.S\\	   S	\\
   S
\\   S\\   S\\   S\S\\   4S jjr SS\\\4   S\S\S\\\      S\4
S jjrS rS rSrg)SubscriberClient3   z
A SubscriberClient reads messages similar to Google Pub/Sub.
Any subscribe failures are unlikely to succeed if retried.

Must be used in a `with` block or have __enter__() called before use.
_impl_require_startedNgrpc_asyncio)executornack_handlerreassignment_handlermessage_transformercredentials	transportclient_optionsr!   r"   r#   r$   r%   r&   r'   c          	      |   ^^^^^^ Uc
  [        5       n[        UUUUUUU4S j5      U l        [        5       U l        g)aX  
Create a new SubscriberClient.

Args:
    executor: A ThreadPoolExecutor to use. The client will shut it down on __exit__. If provided a single threaded executor, messages will be ordered per-partition, but take care that the callback does not block for too long as it will impede forward progress on all subscriptions.
    nack_handler: A handler for when `nack()` is called. The default NackHandler raises an exception and fails the subscribe stream.
    message_transformer: A transformer from Pub/Sub Lite messages to Cloud Pub/Sub messages. This may not return a message with "message_id" set.
    credentials: If provided, the credentials to use when connecting.
    transport: The transport to use. Must correspond to an asyncio transport.
    client_options: The client options to use when connecting. If used, must explicitly set `api_endpoint`.
Nc                 &   > [        U TUTTTUTTS9	$ N)	subscriptionr&   #per_partition_flow_control_settingsr"   r#   r$   fixed_partitionsr%   r'   r   	r+   
partitionssettingsr'   r%   r$   r"   r#   r&   s	      Hlib/third_party/google/cloud/pubsublite/cloudpubsub/subscriber_client.py<lambda>+SubscriberClient.__init__.<locals>.<lambda>X   &    7L)#4<)%9$7!+'-
8    )r   r   r   r   r   )selfr!   r"   r#   r$   r%   r&   r'   s     ``````r1   __init__SubscriberClient.__init__>   s9    , )+H0
 


 !/ 0r5   r+   callbackr,   r-   returnc                 r    U R                   R                  5         U R                  R                  UUUU5      $ Nr   require_startedr   	subscribe)r6   r+   r9   r,   r-   s        r1   r?   SubscriberClient.subscribef   s9     	--/zz##/	
 	
r5   c                 n    U R                   R                  5         U R                  R                  5         U $ r<   )r   	__enter__r   r6   s    r1   rB   SubscriberClient.__enter__u   s)    '')

r5   c                 t    U R                   R                  XU5        U R                  R                  XU5        g r<   )r   __exit__r   r6   exc_type	exc_value	tracebacks       r1   rF   SubscriberClient.__exit__z   s,    

H;&&xIFr5   r   r   r<   )__name__
__module____qualname____firstlineno____doc__r   __annotations__r   r   r   r   r   r   r	   strr   r7   r   r   r   r   r   r   r
   r?   rB   rF   __static_attributes__ r5   r1   r   r   3   s     %$$$
 26.2>B<@-1'26&1 -.&1 {+	&1
 '':;&1 &&89&1 k*&1 &1 !/&1Z 6:
,c12
 "
 .A	

 #3y>2
 


Gr5   r   c                       \ rS rSr% Sr\\S'   \\S'   SSSSSSS.S\\	   S	\\
   S
\\   S\\   S\S\\   4S jjr SS\\\4   S\S\\\      S\\   4S jjrS rS rSrg)AsyncSubscriberClient   z
An AsyncSubscriberClient reads messages similar to Google Pub/Sub, but must be used in an
async context.
Any subscribe failures are unlikely to succeed if retried.

Must be used in an `async with` block or have __aenter__() awaited before use.
r   r   Nr    )r"   r#   r$   r%   r&   r'   r"   r#   r$   r%   r&   r'   c                `   ^^^^^^ [        UUUUUU4S j5      U l        [        5       U l        g)aC  
Create a new AsyncSubscriberClient.

Args:
    nack_handler: A handler for when `nack()` is called. The default NackHandler raises an exception and fails the subscribe stream.
    message_transformer: A transformer from Pub/Sub Lite messages to Cloud Pub/Sub messages. This may not return a message with "message_id" set.
    credentials: If provided, the credentials to use when connecting.
    transport: The transport to use. Must correspond to an asyncio transport.
    client_options: The client options to use when connecting. If used, must explicitly set `api_endpoint`.
c                 &   > [        U TUTTTUTTS9	$ r*   r   r.   s	      r1   r2   0AsyncSubscriberClient.__init__.<locals>.<lambda>   r4   r5   N)r   r   r   r   )r6   r"   r#   r$   r%   r&   r'   s    ``````r1   r7   AsyncSubscriberClient.__init__   s(    ( 6
 


 !/ 0r5   r+   r,   r-   r:   c                    #    U R                   R                  5         U R                  R                  XU5      I S h  vN $  N7fr<   r=   )r6   r+   r,   r-   s       r1   r?   AsyncSubscriberClient.subscribe   s@      	--/ZZ))?O
 
 	
 
s   :AAAc                    #    U R                   R                  5         U R                  R                  5       I S h  vN   U $  N7fr<   )r   rB   r   
__aenter__rC   s    r1   r`    AsyncSubscriberClient.__aenter__   s7     '')jj##%%% 	&s   8AAAc                    #    U R                   R                  XU5      I S h  vN   U R                  R                  XU5        g  N!7fr<   )r   	__aexit__r   rF   rG   s       r1   rc   AsyncSubscriberClient.__aexit__   s;     jj""8	BBB&&xIF 	Cs    AA"ArL   r<   )rM   rN   rO   rP   rQ   r   rR   r   r   r   r   r   r	   rS   r   r7   r   r   r   r   r   r   r   r?   r`   rc   rT   rU   r5   r1   rW   rW      s     *)$$
 /3>B<@-1'26!1 {+!1 '':;	!1
 &&89!1 k*!1 !1 !/!1N 6:		
,c12	
 .A	
 #3y>2		

 
w		

Gr5   rW   N))concurrent.futures.threadr   typingr   r   r   r   google.api_core.client_optionsr   google.auth.credentialsr	   )google.cloud.pubsub_v1.subscriber.futuresr
   )google.cloud.pubsub_v1.subscriber.messager   8google.cloud.pubsublite.cloudpubsub.reassignment_handlerr   <google.cloud.pubsublite.cloudpubsub.internal.make_subscriberr   Pgoogle.cloud.pubsublite.cloudpubsub.internal.multiplexed_async_subscriber_clientr   Jgoogle.cloud.pubsublite.cloudpubsub.internal.multiplexed_subscriber_clientr   7google.cloud.pubsublite.cloudpubsub.message_transformerr   0google.cloud.pubsublite.cloudpubsub.nack_handlerr   ?google.cloud.pubsublite.cloudpubsub.subscriber_client_interfacer   r   r   Cgoogle.cloud.pubsublite.internal.constructable_from_service_accountr   0google.cloud.pubsublite.internal.require_startedr   google.cloud.pubsublite.typesr   r   r   r   rW   rU   r5   r1   <module>ru      s    9 6 6 8 / I = X W H 
 L IG02Q IGXCG"$CCGr5   