nats-architecture-and-design icon indicating copy to clipboard operation
nats-architecture-and-design copied to clipboard

KV watch should allow option for durable consumer

Open aricart opened this issue 3 years ago • 2 comments

If the watch is used as a reactive mechanism for updating on changes, the current implementation which notifies of 'current values', creates an issue, that every time the process starts, it gets spammed with startup values. The process could filter those updates pending some sequence/etc, but this is effectively the functionality of the durable consumer.

An option should be provided to make the watch/history consumer be durable if desired. This would allow a restarting process to trigger updates only if things changed while the process was offline.

https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md

aricart avatar Dec 02 '21 19:12 aricart

I'm a bit reluctant to support this in the main KV ADR because it's going to be impossible to support against any other backend and seems a bit weird to me.

I see the usecase but it feels a bit like something we should probably support as a language specific extension or something rather than something in the core feature set

ripienaar avatar Dec 03 '21 09:12 ripienaar

Maybe this can be a store specific option. I could see in the future that there will be other store specific options, we might as well think about ways to support that. In fact Our api currently does not have a way for a type of store to be selected. Maybe we should implement something, even though the only choice will be JetStream for right now.

scottf avatar Dec 06 '21 17:12 scottf