gcloud pubsub subscriptions pull 经常报空消息列表
gcloud pubsub subscriptions pull often report empty message list
为什么订阅中有消息需要确认,但"gcloud pubsub subscriptions pull"经常报空消息列表?
效果见下图。消息 118870127432164 在订阅中可用,它从未被确认,但通常不会被报告。
lab@ubu1:~$ while :; do date; gcloud pubsub subscriptions pull projects/PROJECT/subscriptions/killbill-queue; done
Wed Jun 13 15:31:48 -03 2018
┌──────┬─────────────────┬───────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DATA │ MESSAGE_ID │ ATTRIBUTES │ ACK_ID │
├──────┼─────────────────┼───────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 6�� │ 118870127432164 │ billingAccountId=000000-000000-000000 │ TDgBRElTK0MLKlgRTgQhIT4wPkVTRFAGFixdRkhRNxkIaFEOT14jPzUgKEUSAgVPAihdeTBLNkFddgA-DRlyfWF0bFlFUAEQB3ZfWBEMYlxORAdzMhhzdWlyalsRBgZGUX9ZXzOA6NOyt7d6ZiQ9XhJLLD5-MzRFQV5AEg │
└──────┴─────────────────┴───────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Wed Jun 13 15:31:50 -03 2018
Listed 0 items.
Wed Jun 13 15:31:53 -03 2018
Listed 0 items.
Wed Jun 13 15:31:56 -03 2018
Listed 0 items.
Wed Jun 13 15:31:59 -03 2018
┌──────┬─────────────────┬───────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DATA │ MESSAGE_ID │ ATTRIBUTES │ ACK_ID │
├──────┼─────────────────┼───────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 6�� │ 118870127432164 │ billingAccountId=000000-000000-000000 │ TDgBRElTK0MLKlgRTgQhIT4wPkVTRFAGFixdRkhRNxkIaFEOT14jPzUgKEUSAgVPAihdeTBLNkFddgA-DRlyfWF0bFlFUAEQB3ZfWBEMYlxORAdzMhhzdWlyalsRBgZGUX9ZXzOA6NOyt7d6ZiQ9XhJLLD5-MzRFQV5AEg │
└──────┴─────────────────┴───────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Wed Jun 13 15:32:01 -03 2018
Listed 0 items.
Wed Jun 13 15:32:05 -03 2018
Listed 0 items.
Wed Jun 13 15:32:07 -03 2018
Listed 0 items.
您引用的拉取消息是 "outstanding." 这意味着在 Google 云 Pub/Sub 认为它无法从原始订阅者那里获得确认之前,不应将其提供给其他订阅者订户。具体来说,它会一直等到 "Acknowledgement Deadline",然后再向另一个订阅者提供已发布的消息。
From Google's Pub/Sub Documentation(强调我的):
Once a message is sent to a subscriber, the subscriber must either acknowledge or drop the message. A message is considered outstanding once it has been sent out for delivery and before a subscriber acknowledges it. Cloud Pub/Sub will repeatedly attempt to deliver any message that has not been acknowledged or that is not outstanding. A subscriber has a configurable, limited amount of time, or ackDeadline
, to acknowledge the message. Once the deadline has passed, an outstanding message becomes unacknowledged.
根据您分享的上下文,您似乎看到了默认确认截止时间超时:
An acknowledgment deadline: If your code doesn't acknowledge the message before the deadline, the message is sent again. The default is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes).
"often pull empty message" 标题有点误导和含蓄,标题也可以是“gcloud pubsub subscriptions pull acknowledges”
因为这就是你认为它发生的事情 returns 一个空列表,从那里的答案将解释它实际上没有确认,但消息只是暂时在 'outstanding' 到达 ack 截止日期前的状态,然后再次返回 que。
为什么订阅中有消息需要确认,但"gcloud pubsub subscriptions pull"经常报空消息列表?
效果见下图。消息 118870127432164 在订阅中可用,它从未被确认,但通常不会被报告。
lab@ubu1:~$ while :; do date; gcloud pubsub subscriptions pull projects/PROJECT/subscriptions/killbill-queue; done
Wed Jun 13 15:31:48 -03 2018
┌──────┬─────────────────┬───────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DATA │ MESSAGE_ID │ ATTRIBUTES │ ACK_ID │
├──────┼─────────────────┼───────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 6�� │ 118870127432164 │ billingAccountId=000000-000000-000000 │ TDgBRElTK0MLKlgRTgQhIT4wPkVTRFAGFixdRkhRNxkIaFEOT14jPzUgKEUSAgVPAihdeTBLNkFddgA-DRlyfWF0bFlFUAEQB3ZfWBEMYlxORAdzMhhzdWlyalsRBgZGUX9ZXzOA6NOyt7d6ZiQ9XhJLLD5-MzRFQV5AEg │
└──────┴─────────────────┴───────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Wed Jun 13 15:31:50 -03 2018
Listed 0 items.
Wed Jun 13 15:31:53 -03 2018
Listed 0 items.
Wed Jun 13 15:31:56 -03 2018
Listed 0 items.
Wed Jun 13 15:31:59 -03 2018
┌──────┬─────────────────┬───────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DATA │ MESSAGE_ID │ ATTRIBUTES │ ACK_ID │
├──────┼─────────────────┼───────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 6�� │ 118870127432164 │ billingAccountId=000000-000000-000000 │ TDgBRElTK0MLKlgRTgQhIT4wPkVTRFAGFixdRkhRNxkIaFEOT14jPzUgKEUSAgVPAihdeTBLNkFddgA-DRlyfWF0bFlFUAEQB3ZfWBEMYlxORAdzMhhzdWlyalsRBgZGUX9ZXzOA6NOyt7d6ZiQ9XhJLLD5-MzRFQV5AEg │
└──────┴─────────────────┴───────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Wed Jun 13 15:32:01 -03 2018
Listed 0 items.
Wed Jun 13 15:32:05 -03 2018
Listed 0 items.
Wed Jun 13 15:32:07 -03 2018
Listed 0 items.
您引用的拉取消息是 "outstanding." 这意味着在 Google 云 Pub/Sub 认为它无法从原始订阅者那里获得确认之前,不应将其提供给其他订阅者订户。具体来说,它会一直等到 "Acknowledgement Deadline",然后再向另一个订阅者提供已发布的消息。
From Google's Pub/Sub Documentation(强调我的):
Once a message is sent to a subscriber, the subscriber must either acknowledge or drop the message. A message is considered outstanding once it has been sent out for delivery and before a subscriber acknowledges it. Cloud Pub/Sub will repeatedly attempt to deliver any message that has not been acknowledged or that is not outstanding. A subscriber has a configurable, limited amount of time, or
ackDeadline
, to acknowledge the message. Once the deadline has passed, an outstanding message becomes unacknowledged.
根据您分享的上下文,您似乎看到了默认确认截止时间超时:
An acknowledgment deadline: If your code doesn't acknowledge the message before the deadline, the message is sent again. The default is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes).
"often pull empty message" 标题有点误导和含蓄,标题也可以是“gcloud pubsub subscriptions pull acknowledges”
因为这就是你认为它发生的事情 returns 一个空列表,从那里的答案将解释它实际上没有确认,但消息只是暂时在 'outstanding' 到达 ack 截止日期前的状态,然后再次返回 que。