Class AsyncSubscriberClient (0.6.1)

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.

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.