【问题标题】:PubSub Lite: Acknowledge all messages currently in backlogPubSub Lite:确认当前积压的所有消息
【发布时间】:2021-12-19 13:12:12
【问题描述】:

如何确认当前积压在 Google PubSub Lite 订阅中的所有消息。我尝试使用

gcloud pubsub lite-subscriptions ack-up-to SUBSCRIPTION \
  --location LOCATION --partition PARTITION --offset OFFSET --project PROJECT

但我不知道如何相应地设置偏移量。

【问题讨论】:

    标签: google-cloud-pubsublite


    【解决方案1】:

    要从 Lite 订阅接收消息,请从 Lite 订阅请求消息。客户端库会自动连接到附加到 Lite 订阅的 Lite 主题中的分区。如果实例化了多个订阅客户端,则消息将分发到所有客户端。主题中的分区数量决定了可以同时连接到订阅的订阅者客户端的最大数量。您可以查看更多documentation 和示例。

    您可以查看以下示例来接收来自 Lite 订阅的消息:

    gcloud pubsub lite-subscriptions subscribe SUBSCRIPTION_ID \
        --location=LITE_LOCATION \
        --auto-ack
    

    但如果你想订阅 Pub/Sub Lite 订阅并自动确认消息,你可以看这个例子:

    gcloud pubsub lite-subscriptions subscribe mysubscription --location=us-central1-a --auto-ack
    

    要订阅订阅中的特定分区,此示例:

    gcloud pubsub lite-subscriptions subscribe mysubscription --location=us-central1-a --partitions=0,1,2
    

    你可以看到更多关于这些例子的documentation

    【讨论】:

      猜你喜欢
      • 2020-08-08
      • 2018-01-01
      • 2019-07-02
      • 2021-06-18
      • 2021-10-17
      • 1970-01-01
      • 2020-05-05
      • 2020-12-06
      • 2021-03-05
      相关资源
      最近更新 更多