我正在尝试为Google Cloud pub / sub写一个基于推送的订阅者
我的代码如下
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create(subscriptionAdminSettings)) {
ProjectSubscriptionName name = ProjectSubscriptionName.of(PROJECT, SUBSCRIPTION_NAME);
ProjectTopicName topic = ProjectTopicName.of(PROJECT, TOPIC_NAME);
PushConfig pushConfig = PushConfig.newBuilder().setPushEndpoint(PUSH_ENDPOINT).build();
int ackDeadlineSeconds = 5;
Subscription subscription = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
}
但是,我在运行时遇到此错误
The supplied HTTP URL is not registered in the subscription's parent project
(url="https://...", project_id="8xxxxxxxxx5").
我需要在哪里注册该URL?在项目中的某个位置或主题?
找到了一些讨论here,但由于其中的某些链接现在正在重定向到其他文档,因此似乎有些陈旧。
答案 0 :(得分:0)
为防止不受欢迎的流量,Cloud Pub / Sub要求您验证对推送端点的所有权。请按照https://cloud.google.com/pubsub/docs/push#domain_ownership_validation上的步骤来验证您的推送端点的所有权。