nats-io/nats.net.v2

Add versions of KV commands that don't throw exceptions?

darkwatchuk opened this issue · 1 comments

Proposed change

Add versions of KV commands that don't throw exceptions. Throwing exceptions in all cases when you're just interested in the outcome of an operation seems a bit overkill?

Use case

Some good uses for KV stores including leader election where we regularly try and get a lock on a resource. So a TryCreateAsync call where we get a bool might be better than calling CreateAsync and getting exceptions thrown constantly from the API. We may call this method every 1-3 seconds...

Likewise, just being interested in whether a kv pair exists or not might not need exceptions thrown all the time?

Contribution

Happy to look at this if can agree on the signatures...

mtmk commented

sounds reasonable to me. Once we establish a pattern we should potentially apply this to other JetStream APIs.