Closed databasedav closed 2 years ago
The 2.7.2 server which was recently released allows NAKs to take an arbitrary delay.
https://github.com/nats-io/nats-server/pull/2812
This feature has not be surfaced in all clients yet.
@derekcollison this is great, thanks!
so the strategy for now should be something like
start poll
send poll message to stream
poll message is pulled by a consumer immediately
consumer naks message with delay = poll end - now
poll message will next be pulled by consumer once the poll has ended
there's one level of indirection, but this totally suffices for me, i'll close the issue after getting this into the python client :)
That is correct, meaning you can NAK a message now and tell it to not be redelivered until the delay has passed.
We are still considering embargoed messages, but nothing definitive yet on that front.
added to python client here https://github.com/nats-io/nats.py/pull/268
Feature Request
allow specifying a timestamp/delay for when message will be available for pulling by consumers; this is a bump for https://github.com/nats-io/nats-server/issues/514 and https://github.com/nats-io/jetstream/issues/417, neither of which had satisfying conclusions (imo) at least in relation to jetstream
Use Case:
for example, say i'm running a poll and want to aggregate the results/do analysis on its results/spread its results only after a certain amount of time has passed, i want to avoid having to constantly poll a database to see if there are valid polls for "closing out", instead i want to simply consume from the "finished polls" stream and react to its messages
Proposed Change:
allow specifying a timestamp/delay for when message will be available for pulling by consumers
Who Benefits From The Change(s)?
any application which needs basic message scheduling
Alternative Approaches
constantly nak a message until its "consumption time" has arrived