简体   繁体   English

谷歌云发布子延迟消息

[英]google cloud pub sub delayed messages

I am building an eCommerce system which includes biding implementation on offers, each offer can include more than one round and each round has startDate and endDate, after each round finishes I want to do other processes such as calculating the winning bids, losing bids, send a notification to users, go to the next round and update offer remaining quantity, all these stuff will work based on the round end date.我正在构建一个电子商务系统,其中包括对报价的投标实施,每个报价可以包括多轮,每一轮都有 startDate 和 endDate,每一轮结束后我想做其他过程​​,例如计算中标、中标、中标、发送通知用户,进入下一轮并更新报价剩余数量,所有这些都将根据轮次结束日期起作用。 We selected GC pub-sub as a solution to publish events and messages once the round is created and add listeners to this event to work and do the wanted processes, but the only missing thing in the solution is the ability to delay each message or scheduling it until the round end date comes then the listeners can work on我们选择了 GC pub-sub 作为在创建回合后发布事件和消息的解决方案,并向该事件添加侦听器以工作和执行所需的过程,但该解决方案中唯一缺少的是延迟每条消息或调度的能力直到回合结束日期到来,听众才能继续工作

so how can I set a date or timestamp for each message when I publish them to be processed later when this date comes?那么如何在发布消息时为每条消息设置日期或时间戳,以便在此日期到来时稍后处理?

I am using node js我正在使用节点js

For using delayed message, you have to use Cloud Task .要使用延迟消息,您必须使用Cloud Task You have a sample code here line 67.第 67 行有一个示例代码。

You can try to use https://github.com/maksimru/event-scheduler , put it between your publisher and receiver.您可以尝试使用https://github.com/maksimru/event-scheduler ,将其放在您的发布者和接收者之间。 It will hold your scheduled messages and release to target topic at specified time它将保留您预定的消息并在指定时间发布到目标主题

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

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