You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behaviour is on purpose, as in distributed systems like NATS, retrying the same operation in case of failure might be necessary in case of transient unavailability and by making Create idempotent, we ensure that no suprisings errors will happen if first attempt timed out, while second sends error already created. This can happen if first request actually worked, but failed to send confirmation. If Create would send error, from user perspective, none of operations were successful.
The distinction between create and update is to:
Protect Update from accidental cration of non-existing resources
Protect Create from accidental update of existing resource
If config is exactly the same, it's a noop for the server/meta leader.
@Jarema thank you for the quick update. However, as I said, than this should be explicitly documented, correct? I cannot find any reference about this behavior, yet your verbose explanation is very precise and helpful, so perhaps it could be incorporated in the docs right away? :)
This is fantastic info! Thank you so much for your quick support; actually, this is desired behavior for my use case, I just wasn't sure if it is designed exactly that way!
Observed behavior
AddConsumer
returns no error if it "creates" already existing consumer with exactly the same configuration options.Expected behavior
Return
JSErrCodeConsumerAlreadyExists
for the same configuration of existing consumer on the server.Server and client version
nats-server
Version: 2.10.9
Git Commit: a5298e2
Driver
github.com/nats-io/nats.go v1.32.0
Host environment
Host
go version go1.20.13 windows/amd64
Server
x64/aarch64 Linux NATS cluster with versions 2.10.9
Steps to reproduce
Invoke
AddConsumer
with anats.ConsumerConfig{}
configuration and repeat it again with the same configuration.I would either expect an error or more verbose documentation about this behavior.
The text was updated successfully, but these errors were encountered: