简体   繁体   English

GCP 发布/订阅优先级队列

[英]GCP Pub/Sub priority queue

I have pub/sub topics, a pull subscriptions and a data pipelines that pull messages using python and NodeJS implementation of the GCP pub/sub library.我有发布/订阅主题、拉取订阅和使用 python 和 GCP 发布/订阅库的 NodeJS 实现拉取消息的数据管道。

I have an endless regular streaming workload and ad-hoc workloads.我有无穷无尽的常规流媒体工作负载和临时工作负载。 I want to prioritize the ad-hoc workloads immediately when needed.我想在需要时立即确定临时工作负载的优先级。

How do I do that?我怎么做?

Creating an additional pub/sub topic for each pipeline seems like a wrong solution.为每个管道创建一个额外的发布/订阅主题似乎是一个错误的解决方案。 There must be another way to prioritize ad-hoc workloads.必须有另一种方法来确定临时工作负载的优先级。

As mentioned in this stackoverflow thread , Pub/Sub does not provide any mechanism to prioritise a message.正如这个 stackoverflow 线程中提到的,Pub/Sub 不提供任何机制来确定消息的优先级。 Moreover this feature would come into picture if the subscribers are not able to keep up with the publishing rate which is resulting in high backlog messages.此外,如果订阅者无法跟上导致大量积压消息的发布速度,则此功能将会出现。 If subscribers are keeping up and processing and acking messages quickly, then the notion of "priority" messages isn't really necessary.如果订阅者跟上并快速处理和确认消息,那么“优先”消息的概念就没有必要了。

If a backlog is being built up and some messages needs to be processed with higher priority, then you can consider creating a different "high-priority" topic and subscription.如果正在建立积压并且需要以更高优先级处理某些消息,那么您可以考虑创建不同的“高优先级”主题和订阅。 The subscribers subscribe to this subscription as well as the "normal" subscription and prioritize processing messages from the "high-priority" subscription whenever they arrive.订阅者订阅此订阅以及“正常”订阅,并在消息到达时优先处理来自“高优先级”订阅的消息。

There is no way to prioritize particular messages.无法确定特定消息的优先级。 I think the right way is to create a separate topic.我认为正确的方法是创建一个单独的主题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM