Skip to content

Commit

Permalink
docs: add documentation that Publisher and Subscriber must be used in…
Browse files Browse the repository at this point in the history
… a `with` block (#55)
  • Loading branch information
dpcollins-google committed Oct 26, 2020
1 parent 457a74d commit 32bc302
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions google/cloud/pubsublite/cloudpubsub/publisher.py
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/pubsublite/cloudpubsub/subscriber.py
Expand Up @@ -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
Expand Down

0 comments on commit 32bc302

Please sign in to comment.