diff --git a/google/cloud/pubsublite/cloudpubsub/publisher.py b/google/cloud/pubsublite/cloudpubsub/publisher.py index f0b83df1..7824de51 100644 --- a/google/cloud/pubsublite/cloudpubsub/publisher.py +++ b/google/cloud/pubsublite/cloudpubsub/publisher.py @@ -7,6 +7,8 @@ class AsyncPublisher(AsyncContextManager): """ An AsyncPublisher publishes messages similar to Google Pub/Sub, but must be used in an async context. Any publish failures are permanent. + + Must be used in an `async with` block or have __aenter__() awaited before use. """ @abstractmethod @@ -32,6 +34,8 @@ async def publish( class Publisher(ContextManager): """ A Publisher publishes messages similar to Google Pub/Sub. Any publish failures are permanent. + + Must be used in a `with` block or have __enter__() called before use. """ @abstractmethod diff --git a/google/cloud/pubsublite/cloudpubsub/subscriber.py b/google/cloud/pubsublite/cloudpubsub/subscriber.py index 3ba66e44..1015f70b 100644 --- a/google/cloud/pubsublite/cloudpubsub/subscriber.py +++ b/google/cloud/pubsublite/cloudpubsub/subscriber.py @@ -7,6 +7,8 @@ class AsyncSubscriber(AsyncContextManager): """ A Cloud Pub/Sub asynchronous subscriber. + + Must be used in an `async with` block or have __aenter__() awaited before use. """ @abstractmethod