简体   繁体   中英

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. 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

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

For using delayed message, you have to use Cloud Task . You have a sample code here line 67.

You can try to use https://github.com/maksimru/event-scheduler , put it between your publisher and receiver. It will hold your scheduled messages and release to target topic at specified time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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