Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Commit 330061c

Browse files
feat: add exactly once delivery flag (#1487)
* feat: add exactly once delivery flag PiperOrigin-RevId: 426415626 Source-Link: googleapis/googleapis@1f707ab Source-Link: googleapis/googleapis-gen@2baebc5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmJhZWJjNTc5ZWQ0MmM0ZDE3ODgzYTE0ZWNhNjQ0MTFmNjlkY2M4NyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Merge branch 'owl-bot-bf34f5ea-4a0a-4412-b431-76abec1c6c4d' of https://github.com/googleapis/nodejs-pubsub into owl-bot-bf34f5ea-4a0a-4412-b431-76abec1c6c4d 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Merge branch 'owl-bot-bf34f5ea-4a0a-4412-b431-76abec1c6c4d' of https://github.com/googleapis/nodejs-pubsub into owl-bot-bf34f5ea-4a0a-4412-b431-76abec1c6c4d 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Merge branch 'main' into owl-bot-bf34f5ea-4a0a-4412-b431-76abec1c6c4d 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md feat: add exactly once delivery flag PiperOrigin-RevId: 426415626 Source-Link: googleapis/googleapis@1f707ab Source-Link: googleapis/googleapis-gen@2baebc5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmJhZWJjNTc5ZWQ0MmM0ZDE3ODgzYTE0ZWNhNjQ0MTFmNjlkY2M4NyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Megan Potter <[email protected]> Co-authored-by: Megan Potter <[email protected]>
1 parent 5d4ddf7 commit 330061c

7 files changed

Lines changed: 1010 additions & 42 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ const {PubSub} = require('@google-cloud/pubsub');
7070

7171
async function quickstart(
7272
projectId = 'your-project-id', // Your Google Cloud Platform project ID
73-
topicName = 'my-topic', // Name for the new topic to create
73+
topicNameOrId = 'my-topic', // Name for the new topic to create
7474
subscriptionName = 'my-sub' // Name for the new subscription to create
7575
) {
7676
// Instantiates a client
7777
const pubsub = new PubSub({projectId});
7878

7979
// Creates a new topic
80-
const [topic] = await pubsub.createTopic(topicName);
80+
const [topic] = await pubsub.createTopic(topicNameOrId);
8181
console.log(`Topic ${topic.name} created.`);
8282

8383
// Creates a subscription on that new topic

protos/google/pubsub/v1/pubsub.proto

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,19 @@ message Subscription {
752752
// the endpoint will not be made.
753753
bool detached = 15;
754754

755+
// If true, Pub/Sub provides the following guarantees for the delivery of
756+
// a message with a given value of `message_id` on this subscription:
757+
//
758+
// * The message sent to a subscriber is guaranteed not to be resent
759+
// before the message's acknowledgement deadline expires.
760+
// * An acknowledged message will not be resent to a subscriber.
761+
//
762+
// Note that subscribers may still receive multiple copies of a message
763+
// when `enable_exactly_once_delivery` is true if the message was published
764+
// multiple times by a publisher client. These copies are considered distinct
765+
// by Pub/Sub and have distinct `message_id` values.
766+
bool enable_exactly_once_delivery = 16;
767+
755768
// Output only. Indicates the minimum duration for which a message is retained
756769
// after it is published to the subscription's topic. If this field is set,
757770
// messages published to the subscription's topic in the last
@@ -1163,15 +1176,50 @@ message StreamingPullRequest {
11631176
// Response for the `StreamingPull` method. This response is used to stream
11641177
// messages from the server to the client.
11651178
message StreamingPullResponse {
1179+
// Acknowledgement IDs sent in one or more previous requests to acknowledge a
1180+
// previously received message.
1181+
message AcknowledgeConfirmation {
1182+
// Successfully processed acknowledgement IDs.
1183+
repeated string ack_ids = 1 [ctype = CORD];
1184+
1185+
// List of acknowledgement IDs that were malformed or whose acknowledgement
1186+
// deadline has expired.
1187+
repeated string invalid_ack_ids = 2 [ctype = CORD];
1188+
1189+
// List of acknowledgement IDs that were out of order.
1190+
repeated string unordered_ack_ids = 3 [ctype = CORD];
1191+
}
1192+
1193+
// Acknowledgement IDs sent in one or more previous requests to modify the
1194+
// deadline for a specific message.
1195+
message ModifyAckDeadlineConfirmation {
1196+
// Successfully processed acknowledgement IDs.
1197+
repeated string ack_ids = 1 [ctype = CORD];
1198+
1199+
// List of acknowledgement IDs that were malformed or whose acknowledgement
1200+
// deadline has expired.
1201+
repeated string invalid_ack_ids = 2 [ctype = CORD];
1202+
}
1203+
11661204
// Subscription properties sent as part of the response.
11671205
message SubscriptionProperties {
1206+
// True iff exactly once delivery is enabled for this subscription.
1207+
bool exactly_once_delivery_enabled = 1;
11681208
// True iff message ordering is enabled for this subscription.
11691209
bool message_ordering_enabled = 2;
11701210
}
11711211

11721212
// Received Pub/Sub messages. This will not be empty.
11731213
repeated ReceivedMessage received_messages = 1;
11741214

1215+
// This field will only be set if `enable_exactly_once_delivery` is set to
1216+
// `true`.
1217+
AcknowledgeConfirmation acknowlege_confirmation = 2;
1218+
1219+
// This field will only be set if `enable_exactly_once_delivery` is set to
1220+
// `true`.
1221+
ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3;
1222+
11751223
// Properties associated with this subscription.
11761224
SubscriptionProperties subscription_properties = 4;
11771225
}

protos/protos.d.ts

Lines changed: 222 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)