Class PublisherClient (1.4.1)

PublisherClient(
    *,
    per_partition_batching_settings: Optional[
        google.cloud.pubsub_v1.types.BatchSettings
    ] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
    transport: str = "grpc_asyncio",
    client_options: Optional[google.api_core.client_options.ClientOptions] = None
)

A PublisherClient publishes messages similar to Google Pub/Sub. Any publish failures are unlikely to succeed if retried.

Must be used in a with block or have enter() called before use.

Inheritance

builtins.object > abc.ABC > contextlib.AbstractContextManager > builtins.object > typing.Generic > google.cloud.pubsublite.cloudpubsub.publisher_client_interface.PublisherClientInterface > builtins.object > google.cloud.pubsublite.internal.constructable_from_service_account.ConstructableFromServiceAccount > PublisherClient

Methods

PublisherClient

PublisherClient(
    *,
    per_partition_batching_settings: Optional[
        google.cloud.pubsub_v1.types.BatchSettings
    ] = 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 PublisherClient.

__enter__

__enter__()

Return self upon entering the runtime context.

__exit__

__exit__(exc_type, exc_value, traceback)

Raise any exception triggered within the runtime context.

publish

publish(
    topic: Union[google.cloud.pubsublite.types.paths.TopicPath, str],
    data: bytes,
    ordering_key: str = "",
    **attrs: Mapping[str, str]
)

Publish a message.

Exceptions
TypeDescription
GoogleApiCallErrorOn a permanent failure.