Skip to content

Commit 2940720

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add message ordering (via synth). (googleapis#7551)
1 parent b866a87 commit 2940720

File tree

5 files changed

+179
-90
lines changed

5 files changed

+179
-90
lines changed

pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ def create_subscription(
224224
retain_acked_messages=None,
225225
message_retention_duration=None,
226226
labels=None,
227+
enable_message_ordering=None,
227228
expiration_policy=None,
228229
retry=google.api_core.gapic_v1.method.DEFAULT,
229230
timeout=google.api_core.gapic_v1.method.DEFAULT,
@@ -309,6 +310,13 @@ def create_subscription(
309310
message :class:`~google.cloud.pubsub_v1.types.Duration`
310311
labels (dict[str -> str]): See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
311312
managing labels</a>.
313+
enable_message_ordering (bool): If true, messages published with the same ``ordering_key`` in
314+
``PubsubMessage`` will be delivered to the subscribers in the order in
315+
which they are received by the Pub/Sub system. Otherwise, they may be
316+
delivered in any order. EXPERIMENTAL: This feature is part of a closed
317+
alpha release. This API might be changed in backward-incompatible ways
318+
and is not recommended for production use. It is not subject to any SLA
319+
or deprecation policy.
312320
expiration_policy (Union[dict, ~google.cloud.pubsub_v1.types.ExpirationPolicy]): A policy that specifies the conditions for this subscription's
313321
expiration. A subscription is considered active as long as any connected
314322
subscriber is successfully consuming messages from the subscription or
@@ -359,6 +367,7 @@ def create_subscription(
359367
retain_acked_messages=retain_acked_messages,
360368
message_retention_duration=message_retention_duration,
361369
labels=labels,
370+
enable_message_ordering=enable_message_ordering,
362371
expiration_policy=expiration_policy,
363372
)
364373
return self._inner_api_calls["create_subscription"](

pubsub/google/cloud/pubsub_v1/proto/pubsub.proto

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ message PubsubMessage {
406406
// it receives the `Publish` call. It must not be populated by the
407407
// publisher in a `Publish` call.
408408
google.protobuf.Timestamp publish_time = 4;
409+
410+
// Identifies related messages for which publish order should be respected.
411+
// If a `Subscription` has `enable_message_ordering` set to `true`, messages
412+
// published with the same `ordering_key` value will be delivered to
413+
// subscribers in the order in which they are received by the Pub/Sub system.
414+
// <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
415+
// API might be changed in backward-incompatible ways and is not recommended
416+
// for production use. It is not subject to any SLA or deprecation policy.
417+
string ordering_key = 5;
409418
}
410419

411420
// Request for the GetTopic method.
@@ -607,6 +616,15 @@ message Subscription {
607616
// managing labels</a>.
608617
map<string, string> labels = 9;
609618

619+
// If true, messages published with the same `ordering_key` in `PubsubMessage`
620+
// will be delivered to the subscribers in the order in which they
621+
// are received by the Pub/Sub system. Otherwise, they may be delivered in
622+
// any order.
623+
// <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
624+
// API might be changed in backward-incompatible ways and is not recommended
625+
// for production use. It is not subject to any SLA or deprecation policy.
626+
bool enable_message_ordering = 10;
627+
610628
// A policy that specifies the conditions for this subscription's expiration.
611629
// A subscription is considered active as long as any connected subscriber is
612630
// successfully consuming messages from the subscription or is issuing

0 commit comments

Comments
 (0)