Replies: 3 comments 4 replies
-
"Could start a timer and remove the message from the stream. Perhaps KV could also be used?" At the moment, as a workaround, my solution is exactly that; Remove these messages from NATS, and store in redis with a ksuid key that enables me to poll the messages with a cursor to find ones that are due for redelivery. This method is fraught with complexity as injecting the message back into NATS triggers the message deduplication feature which makes it disappear. The only solution that I have found is to make a new message ID, and have an Although canny, the presented Wouldn't this discussion be better in the original issue log? #2042 |
Beta Was this translation helpful? Give feedback.
-
Sorry, I get you, it's seems like a very similar use case on first glance, but what you are effectively describing here is message embargo/TTL? It is so close in fact, that the underlying engine for embargo should be able to provide both. TTL is a slightly different creature. @ripienaar has TTL for KV data, it may be worth looking at how he's implemented it if applicable. I was thinking that either way, for embargo, you would need to have mutable headers to reschedule a live message. i.e. once the message is in flight, there is no way to change the time which it gets delivered, as it would require modifying the message delivery time data that is stored in the header. It's probably better to use message metadata, as those values are mutable. |
Beta Was this translation helpful? Give feedback.
-
Hello, i have the same need to keep message in nats until a determinated time. I saw a fork was created here #2733 but it's not merge to the main branch. Are you considering this feature which means very interesting ? |
Beta Was this translation helpful? Give feedback.
-
It would be nice if NATS supported time-sensitive message to solve the below use cases
I'm a long time user of NATS, but very new to contributing. So here is how I think we can approach this problem.
Add support for expiring and deferred messages via NATS headers
Two additional headers can be set by clients to configure time sensitivity
Nats-Before
header expires the message at the Unix timestamp provided in the headerNats-Not-Before
header prevents the message to be consumed before the Unix timestamp provided in the headerIt is possible that users are already building some of this functionality on the client-side using similar headers. So we could make
Nats-Before
andNats-Not-Before
header keys configurable by user.Enable Jetstream messages to be evicted if the
Nats-Before
header passesCould start a timer and remove the message from the stream. Perhaps KV could also be used?
Enable Jetstream to selectively skip messages until the
Nats-Not-Before
timestamp passesNeed Jetstream to not push messages to consumers until
Nats-Not-Before
passes.Will look into this in detail and post updates here.
Beta Was this translation helpful? Give feedback.
All reactions