Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation that Publisher and Subscriber must be used in a with block #55

Merged
merged 1 commit into from Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
dpcollins-google marked this conversation as resolved.
Show resolved Hide resolved
"""

@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.
dpcollins-google marked this conversation as resolved.
Show resolved Hide resolved
"""

@abstractmethod
Expand Down