Skip to content

Commit ea8c652

Browse files
authored
feat(pubsub): support AuthorityOption (#8460)
By default use `pubsub.googleapis.com` as the `authority` in all requests, regardless of the `EndpointOption` value. This improves the support for PSC and VPC-SC.
1 parent a528fcf commit ea8c652

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

google/cloud/pubsub/internal/publisher_metadata.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ void PublisherMetadata::SetMetadata(grpc::ClientContext& context,
100100
context.AddMetadata("x-goog-user-project",
101101
options.get<UserProjectOption>());
102102
}
103+
if (options.has<AuthorityOption>()) {
104+
context.set_authority(options.get<AuthorityOption>());
105+
}
103106
}
104107

105108
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

google/cloud/pubsub/internal/subscriber_metadata.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ void SubscriberMetadata::SetMetadata(grpc::ClientContext& context,
147147
context.AddMetadata("x-goog-user-project",
148148
options.get<UserProjectOption>());
149149
}
150+
if (options.has<AuthorityOption>()) {
151+
context.set_authority(options.get<AuthorityOption>());
152+
}
150153
}
151154

152155
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

0 commit comments

Comments
 (0)