Skip to content

Commit

Permalink
Merge branch 'main' into otel-4
Browse files Browse the repository at this point in the history
  • Loading branch information
feywind authored Nov 3, 2023
2 parents 8649123 + 7b82ff0 commit b325621
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"null-loader": "^4.0.0",
"protobufjs": "^7.0.0",
"proxyquire": "^2.0.0",
"sinon": "^16.0.0",
"sinon": "^17.0.0",
"tmp": "^0.2.0",
"ts-loader": "^9.0.0",
"typescript": "^5.1.6",
Expand Down
27 changes: 14 additions & 13 deletions protos/google/pubsub/v1/pubsub.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ service Publisher {
"https://www.googleapis.com/auth/pubsub";

// Creates the given topic with the given name. See the [resource name rules]
// (https://cloud.google.com/pubsub/docs/admin#resource_names).
// (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
rpc CreateTopic(Topic) returns (Topic) {
option (google.api.http) = {
put: "/v1/{name=projects/*/topics/*}"
Expand Down Expand Up @@ -137,11 +137,12 @@ service Publisher {

// A policy constraining the storage of messages published to the topic.
message MessageStoragePolicy {
// A list of IDs of GCP regions where messages that are published to the topic
// may be persisted in storage. Messages published by publishers running in
// non-allowed GCP regions (or running outside of GCP altogether) will be
// routed for storage in one of the allowed regions. An empty list means that
// no regions are allowed, and is not a valid configuration.
// A list of IDs of Google Cloud regions where messages that are published
// to the topic may be persisted in storage. Messages published by publishers
// running in non-allowed Google Cloud regions (or running outside of Google
// Cloud altogether) are routed for storage in one of the allowed regions.
// An empty list means that no regions are allowed, and is not a valid
// configuration.
repeated string allowed_persistence_regions = 1;
}

Expand Down Expand Up @@ -430,16 +431,16 @@ service Subscriber {
"https://www.googleapis.com/auth/pubsub";

// Creates a subscription to a given topic. See the [resource name rules]
// (https://cloud.google.com/pubsub/docs/admin#resource_names).
// (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
// If the subscription already exists, returns `ALREADY_EXISTS`.
// If the corresponding topic doesn't exist, returns `NOT_FOUND`.
//
// If the name is not provided in the request, the server will assign a random
// name for this subscription on the same project as the topic, conforming
// to the [resource name format]
// (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
// name is populated in the returned Subscription object. Note that for REST
// API requests, you must specify a name in the request.
// (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
// generated name is populated in the returned Subscription object. Note that
// for REST API requests, you must specify a name in the request.
rpc CreateSubscription(Subscription) returns (Subscription) {
option (google.api.http) = {
put: "/v1/{name=projects/*/subscriptions/*}"
Expand Down Expand Up @@ -592,7 +593,7 @@ service Subscriber {
// the request, the server will assign a random
// name for this snapshot on the same project as the subscription, conforming
// to the [resource name format]
// (https://cloud.google.com/pubsub/docs/admin#resource_names). The
// (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
// generated name is populated in the returned Snapshot object. Note that for
// REST API requests, you must specify a name in the request.
rpc CreateSnapshot(CreateSnapshotRequest) returns (Snapshot) {
Expand Down Expand Up @@ -1429,8 +1430,8 @@ message CreateSnapshotRequest {
// in the request, the server will assign a random name for this snapshot on
// the same project as the subscription. Note that for REST API requests, you
// must specify a name. See the [resource name
// rules](https://cloud.google.com/pubsub/docs/admin#resource_names). Format
// is `projects/{project}/snapshots/{snap}`.
// rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
// Format is `projects/{project}/snapshots/{snap}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" }
Expand Down
7 changes: 6 additions & 1 deletion src/message-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,13 @@ export class MessageStream extends PassThrough {
? 0
: this._subscriber.maxBytes,
};
const otherArgs = {
headers: {
'x-goog-request-params': 'subscription=' + this._subscriber.name,
},
};

const stream: PullStream = client.streamingPull({deadline});
const stream: PullStream = client.streamingPull({deadline, otherArgs});
this._replaceStream(index, stream);
stream.write(request);
}
Expand Down
2 changes: 1 addition & 1 deletion src/v1/publisher_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export class PublisherClient {
// -------------------
/**
* Creates the given topic with the given name. See the [resource name rules]
* (https://cloud.google.com/pubsub/docs/admin#resource_names).
* (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
*
* @param {Object} request
* The request object that will be sent.
Expand Down
14 changes: 7 additions & 7 deletions src/v1/subscriber_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ export class SubscriberClient {
// -------------------
/**
* Creates a subscription to a given topic. See the [resource name rules]
* (https://cloud.google.com/pubsub/docs/admin#resource_names).
* (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
* If the subscription already exists, returns `ALREADY_EXISTS`.
* If the corresponding topic doesn't exist, returns `NOT_FOUND`.
*
* If the name is not provided in the request, the server will assign a random
* name for this subscription on the same project as the topic, conforming
* to the [resource name format]
* (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
* name is populated in the returned Subscription object. Note that for REST
* API requests, you must specify a name in the request.
* (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
* generated name is populated in the returned Subscription object. Note that
* for REST API requests, you must specify a name in the request.
*
* @param {Object} request
* The request object that will be sent.
Expand Down Expand Up @@ -1324,7 +1324,7 @@ export class SubscriberClient {
* the request, the server will assign a random
* name for this snapshot on the same project as the subscription, conforming
* to the [resource name format]
* (https://cloud.google.com/pubsub/docs/admin#resource_names). The
* (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
* generated name is populated in the returned Snapshot object. Note that for
* REST API requests, you must specify a name in the request.
*
Expand All @@ -1335,8 +1335,8 @@ export class SubscriberClient {
* in the request, the server will assign a random name for this snapshot on
* the same project as the subscription. Note that for REST API requests, you
* must specify a name. See the [resource name
* rules](https://cloud.google.com/pubsub/docs/admin#resource_names). Format
* is `projects/{project}/snapshots/{snap}`.
* rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
* Format is `projects/{project}/snapshots/{snap}`.
* @param {string} request.subscription
* Required. The subscription whose backlog the snapshot retains.
* Specifically, the created snapshot is guaranteed to retain:
Expand Down

0 comments on commit b325621

Please sign in to comment.