Depends on if you write the subscribers as well or not:
You have control over your subscriber's code:
- In your PubSub messages add a timestamp for when you want that message to be processed.
- In your clients (subscribers), have logic to acknowledge the message only if the timestamp to process the message is reached.
- PubSub will retry delivering the message until it's acknowledged (or 10 days)
If you don't have control over your subscriber you can have a my-topic
and my-delayed-topic
. Folks can publish to the former topic and that topic will have only one subscriber which you will implement:
- Publish message as before to
my-topic
.
- You will have a subscriber for that topic that can do the same throttling as shown above.
- If the time for that message has reached your handler will publish/relay that message to
my-delayed-topic
.
You can also implement the logic above with task-queue+pubsub-topic instead of pubsub-topic+pubsub-topic.