Skip to content

Commit 4607dca

Browse files
acocuzzogcf-owl-bot[bot]dandhlee
authored
Docs: Add attributes to pubsub_v1.types (#921)
* Docs: Add Attributes to pubsub_v1.types * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix lint * fix indent * Apply suggestions from code review Co-authored-by: Dan Lee <[email protected]> * Apply suggestions from code review Co-authored-by: Dan Lee <[email protected]> --------- Co-authored-by: Owl Bot Co-authored-by: Dan Lee <[email protected]>
1 parent 15d6cdf commit 4607dca

File tree

1 file changed

+64
-3
lines changed

1 file changed

+64
-3
lines changed

google/cloud/pubsub_v1/types.py

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,21 @@
6161
# these settings can be altered to tweak Pub/Sub behavior.
6262
# The defaults should be fine for most use cases.
6363
class BatchSettings(NamedTuple):
64-
"""The settings for batch publishing the messages."""
64+
"""The settings for batch publishing the messages.
65+
66+
Attributes:
67+
max_bytes (int):
68+
The maximum total size of the messages to collect before automatically
69+
publishing the batch, including any byte size overhead of the publish
70+
request itself. The maximum value is bound by the server-side limit of
71+
10_000_000 bytes. Defaults to 1 MB.
72+
max_latency (float):
73+
The maximum number of seconds to wait for additional messages before
74+
automatically publishing the batch. Defaults to 10ms.
75+
max_messages (int):
76+
The maximum number of messages to collect before automatically
77+
publishing the batch. Defaults to 100.
78+
"""
6579

6680
max_bytes: int = 1 * 1000 * 1000 # 1 MB
6781
(
@@ -93,7 +107,19 @@ class LimitExceededBehavior(str, enum.Enum):
93107

94108

95109
class PublishFlowControl(NamedTuple):
96-
"""The client flow control settings for message publishing."""
110+
"""The client flow control settings for message publishing.
111+
112+
Attributes:
113+
message_limit (int):
114+
The maximum number of messages awaiting to be published.
115+
Defaults to 1000.
116+
byte_limit (int):
117+
The maximum total size of messages awaiting to be published.
118+
Defaults to 10MB.
119+
limit_exceeded_behavior (LimitExceededBehavior):
120+
The action to take when publish flow control limits are exceeded.
121+
Defaults to LimitExceededBehavior.IGNORE.
122+
"""
97123

98124
message_limit: int = 10 * BatchSettings.__new__.__defaults__[2] # type: ignore
99125
"""The maximum number of messages awaiting to be published."""
@@ -110,7 +136,22 @@ class PublishFlowControl(NamedTuple):
110136
# This class is used when creating a publisher client to pass in options
111137
# to enable/disable features.
112138
class PublisherOptions(NamedTuple):
113-
"""The options for the publisher client."""
139+
"""The options for the publisher client.
140+
141+
Attributes:
142+
enable_message_ordering (bool):
143+
Whether to order messages in a batch by a supplied ordering key.
144+
Defaults to false.
145+
flow_control (PublishFlowControl):
146+
Flow control settings for message publishing by the client. By default
147+
the publisher client does not do any throttling.
148+
retry (OptionalRetry):
149+
Retry settings for message publishing by the client. This should be
150+
an instance of :class:`google.api_core.retry.Retry`.
151+
timeout (OptionalTimeout):
152+
Timeout settings for message publishing by the client. It should be
153+
compatible with :class:`~.pubsub_v1.types.TimeoutType`.
154+
"""
114155

115156
enable_message_ordering: bool = False
116157
"""Whether to order messages in a batch by a supplied ordering key."""
@@ -142,6 +183,26 @@ class PublisherOptions(NamedTuple):
142183
class FlowControl(NamedTuple):
143184
"""The settings for controlling the rate at which messages are pulled
144185
with an asynchronous subscription.
186+
187+
Attributes:
188+
max_bytes (int):
189+
The maximum total size of received - but not yet processed - messages
190+
before pausing the message stream. Defaults to 100 MiB.
191+
max_messages (int):
192+
The maximum number of received - but not yet processed - messages before
193+
pausing the message stream. Defaults to 1000.
194+
max_lease_duration (float):
195+
The maximum amount of time in seconds to hold a lease on a message
196+
before dropping it from the lease management. Defaults to 1 hour.
197+
min_duration_per_lease_extension (float):
198+
The min amount of time in seconds for a single lease extension attempt.
199+
Must be between 10 and 600 (inclusive). Ignored by default, but set to
200+
60 seconds if the subscription has exactly-once delivery enabled.
201+
max_duration_per_lease_extension (float):
202+
The max amount of time in seconds for a single lease extension attempt.
203+
Bounds the delay before a message redelivery if the subscriber
204+
fails to extend the deadline. Must be between 10 and 600 (inclusive). Ignored
205+
if set to 0.
145206
"""
146207

147208
max_bytes: int = 100 * 1024 * 1024 # 100 MiB

0 commit comments

Comments
 (0)