【发布时间】:2020-12-07 23:48:39
【问题描述】:
我们正在使用 webhook 来监听 Jira 问题事件。每当票证上发生活动时,JIRA API 都会通知在 Google Cloud Function 内运行的 HTTP 端点。在这个 Cloud Function 中,我们只是通过以下方式将请求原封不动地转发到 Pub/Sub:
def forward_to_pubsub(request):
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(project_id, topic_id)
# Request body contains user, project, issue basically everything we care about
jira_body = request.json
publisher.publish(topic_path, data=json.dumps(jira_body).encode('utf-8'))
这似乎是一个不必要的跳跃。无论如何将 Pub/Sub 配置为 HTTP webhook 的目标?无论哪种方式都无法从文档中弄清楚。
【问题讨论】:
标签: python google-cloud-platform google-cloud-functions webhooks google-cloud-pubsub