Class AsyncSubscriberClient (0.5.0)

Stay organized with collections Save and categorize content based on your preferences.
AsyncSubscriberClient(
    nack_handler: Optional[
        google.cloud.pubsublite.cloudpubsub.nack_handler.NackHandler
    ] = None,
    message_transformer: Optional[
        google.cloud.pubsublite.cloudpubsub.message_transformer.MessageTransformer
    ] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
    transport: str = "grpc_asyncio",
    client_options: Optional[google.api_core.client_options.ClientOptions] = None,
)

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.

Inheritance

builtins.object > abc.ABC > contextlib.AbstractAsyncContextManager > builtins.object > typing.Generic > google.cloud.pubsublite.cloudpubsub.subscriber_client_interface.AsyncSubscriberClientInterface > builtins.object > google.cloud.pubsublite.internal.constructable_from_service_account.ConstructableFromServiceAccount > AsyncSubscriberClient

Methods

AsyncSubscriberClient

AsyncSubscriberClient(
    nack_handler: Optional[
        google.cloud.pubsublite.cloudpubsub.nack_handler.NackHandler
    ] = None,
    message_transformer: Optional[
        google.cloud.pubsublite.cloudpubsub.message_transformer.MessageTransformer
    ] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
    transport: str = "grpc_asyncio",
    client_options: Optional[google.api_core.client_options.ClientOptions] = None,
)

Create a new AsyncSubscriberClient.

__aenter__

__aenter__()

Return self upon entering the runtime context.

__aexit__

__aexit__(exc_type, exc_value, traceback)

Raise any exception triggered within the runtime context.

subscribe

subscribe(
    subscription: Union[google.cloud.pubsublite.types.paths.SubscriptionPath, str],
    per_partition_flow_control_settings: google.cloud.pubsublite.types.flow_control_settings.FlowControlSettings,
    fixed_partitions: Optional[
        Set[google.cloud.pubsublite.types.partition.Partition]
    ] = None,
)

Read messages from a subscription.

Exceptions
TypeDescription
GoogleApiCallErrorOn a permanent failure.