Skip to content

Commit

Permalink
feat: add exactly once delivery flag (#1487)
Browse files Browse the repository at this point in the history
* 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 <mzp@google.com>
Co-authored-by: Megan Potter <57276408+feywind@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 16, 2022
1 parent 5d4ddf7 commit 330061c
Show file tree
Hide file tree
Showing 7 changed files with 1,010 additions and 42 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ const {PubSub} = require('@google-cloud/pubsub');

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

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

// Creates a subscription on that new topic
Expand Down
48 changes: 48 additions & 0 deletions protos/google/pubsub/v1/pubsub.proto
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,19 @@ message Subscription {
// the endpoint will not be made.
bool detached = 15;

// If true, Pub/Sub provides the following guarantees for the delivery of
// a message with a given value of `message_id` on this subscription:
//
// * The message sent to a subscriber is guaranteed not to be resent
// before the message's acknowledgement deadline expires.
// * An acknowledged message will not be resent to a subscriber.
//
// Note that subscribers may still receive multiple copies of a message
// when `enable_exactly_once_delivery` is true if the message was published
// multiple times by a publisher client. These copies are considered distinct
// by Pub/Sub and have distinct `message_id` values.
bool enable_exactly_once_delivery = 16;

// Output only. Indicates the minimum duration for which a message is retained
// after it is published to the subscription's topic. If this field is set,
// messages published to the subscription's topic in the last
Expand Down Expand Up @@ -1163,15 +1176,50 @@ message StreamingPullRequest {
// Response for the `StreamingPull` method. This response is used to stream
// messages from the server to the client.
message StreamingPullResponse {
// Acknowledgement IDs sent in one or more previous requests to acknowledge a
// previously received message.
message AcknowledgeConfirmation {
// Successfully processed acknowledgement IDs.
repeated string ack_ids = 1 [ctype = CORD];

// List of acknowledgement IDs that were malformed or whose acknowledgement
// deadline has expired.
repeated string invalid_ack_ids = 2 [ctype = CORD];

// List of acknowledgement IDs that were out of order.
repeated string unordered_ack_ids = 3 [ctype = CORD];
}

// Acknowledgement IDs sent in one or more previous requests to modify the
// deadline for a specific message.
message ModifyAckDeadlineConfirmation {
// Successfully processed acknowledgement IDs.
repeated string ack_ids = 1 [ctype = CORD];

// List of acknowledgement IDs that were malformed or whose acknowledgement
// deadline has expired.
repeated string invalid_ack_ids = 2 [ctype = CORD];
}

// Subscription properties sent as part of the response.
message SubscriptionProperties {
// True iff exactly once delivery is enabled for this subscription.
bool exactly_once_delivery_enabled = 1;
// True iff message ordering is enabled for this subscription.
bool message_ordering_enabled = 2;
}

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

// This field will only be set if `enable_exactly_once_delivery` is set to
// `true`.
AcknowledgeConfirmation acknowlege_confirmation = 2;

// This field will only be set if `enable_exactly_once_delivery` is set to
// `true`.
ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3;

// Properties associated with this subscription.
SubscriptionProperties subscription_properties = 4;
}
Expand Down
222 changes: 222 additions & 0 deletions protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 330061c

Please sign in to comment.