gpt4 book ai didi

google-cloud-platform - Dataflow 是否应该使用来自 Pub/Sub 主题或订阅的事件?

转载 作者:行者123 更新时间:2023-12-02 19:59:04 25 4
gpt4 key购买 nike

我希望使用 Dataflow 将事件从 PubSub 流式传输到 BigQuery。我发现 GCP 中有两个模板可以执行此操作:一个是 Dataflow 从主题读取消息;另一个是 Dataflow 从主题中读取消息。以及订阅中的一份。

在这里使用订阅比仅使用主题中的事件有什么优势?

最佳答案

Core concepts

  • Topic: A named resource to which messages are sent by publishers.

  • Subscription: A named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application.

根据核心概念,区别相当简单:

  • 当您想要将 Dataflow 中的消息发布到 Pub/Sub(事实上,对于给定主题)时,请使用主题

  • 当您想要在 Dataflow 中使用来自 Pub/Sub 的消息时,请使用订阅

因此,根据您的情况,请进行订阅

更多信息:

请注意,Pub/Sub 使用自己的消息存储来管理主题。不过,当您还想在 BigQuery 中移动这些消息(并最终执行您自己的分析)时,Cloud Pub/Sub 主题到 BigQuery 模板特别有用。

The Cloud Pub/Sub Topic to BigQuery template is a streaming pipeline that reads JSON-formatted messages from a Cloud Pub/Sub topic and writes them to a BigQuery table. You can use the template as a quick solution to move Cloud Pub/Sub data to BigQuery. The template reads JSON-formatted messages from Cloud Pub/Sub and converts them to BigQuery elements.

https://cloud.google.com/dataflow/docs/guides/templates/provided-streaming#cloudpubsubtobigquery


免责声明:评论和意见是我自己的,而不是我的雇主的观点。

关于google-cloud-platform - Dataflow 是否应该使用来自 Pub/Sub 主题或订阅的事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56295345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com