简体   繁体   English

如何创建管道以读取主题和死信并等待系统恢复以插入回消息

[英]How to create a pipeline to read from both topic and dead letter and wait until the system is recovered to insert back the messages

I have a dead-letter queue for a pubsub cloud function that is receiving messages using PUSH subscription and at the moment the service is successfully sending those messages to the dead-letter topic and the dead-letter subscription when fails.我有一个 pubsub 云 function 的死信队列,它正在使用 PUSH 订阅接收消息,目前该服务正在成功地将这些消息发送到死信主题和死信订阅失败时。 However, I am uncertain on how to carry on once it reaches this dead-letter subscription.但是,我不确定一旦达到这个死信订阅如何继续。

I don't want to lose the messages that have been sent to the dead letter so my idea would be that in case of failures from the service to acknowledge the message after predefined delivery attempts, the message will be forwarded to a dead letter topic.我不想丢失已发送到死信的消息,因此我的想法是,如果服务在预定义的传递尝试后无法确认消息,则消息将被转发到死信主题。 The same service, when back to life, can pull the messages from the dead-letter topic as well to see what it missed during the times of unavailability.同样的服务在恢复运行时,也可以从死信主题中提取消息,以查看它在不可用期间遗漏了什么。

There is a similar post in here but the answer only points to the options but not the solutions, and unfortunately, I haven't been able to find it. 这里有一个类似的帖子,但答案只指向选项而不是解决方案,不幸的是,我无法找到它。

There is also a mention in here about this issue where it's actually from where I have taken my question. 这里还提到了这个问题,它实际上来自我提出问题的地方。

Please, could somebody point me in the right direction?拜托,有人能指出我正确的方向吗? Is there a better way?有没有更好的办法?

If the main process aren't able to process the messages, you have to rely on the retry mechanism of PubSub.如果主进程无法处理消息,则必须依赖 PubSub 的重试机制。

If you put the messages in a Dead letter topic, it's because you can't process the message with the main function.如果将消息放在死信主题中,那是因为您无法使用主 function 处理消息。 So, it's another process, another function.所以,这是另一个过程,另一个 function。 You can't process with the same function the dead letter message (In fact you can, but it's an anti pattern).您不能使用相同的 function 处理死信消息(实际上可以,但这是一种反模式)。


A good pattern is to save your dead letter message somewhere.一个好的模式是将死信消息保存在某处。 When your main function is up again, trigger a process that read the messages and re publish the messages in the main topic.当您的主 function 再次启动时,触发读取消息并在主主题中重新发布消息的进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将死信消息路由回原始主题? - How to route dead letter messages back to the original topic? 谷歌云发布/订阅 - 订阅者未将消息转发到死信主题 - Google cloud Pub/Sub - subscriber not forwarding messages to dead letter topic 如何从PubSub主题读取数据并将其解析到光束管道中并进行打印 - How to read and parse data from PubSub topic into a beam pipeline and print it PubSub 最大传递尝试次数和死信主题 - PubSub Maximum delivery attempts & Dead letter topic 如何通过转发到死信主题来限制 Google Pub/Sub 交付尝试? - How to limit Google Pub/Sub delivery attempts by forwarding to a dead-letter topic? GCP PubSub 未投递消息和死信消息之间的区别 - GCP PubSub difference between undelivered messages and dead letter messages GCP - 如何添加关于发送到 pubsub 死信队列的消息数量的警报? - GCP - how to add alert on number of messages sent to a pubsub dead letter queue? Google PubSub 将消息订购到死信队列流程 - Google PubSub ordered Messages to Dead Letter Queue process Google Cloud Functions 无法使用 Pub/Sub 死信主题 - Google Cloud Functions can't use Pub/Sub dead-letter topic 如何使用 Terraform 配置 GCP 发布/订阅死信 - How to configure GCP pub/sub dead letter with Terraform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM