-
Hello 👋🏻. Me and my company have been using JetStream as our internal messaging system for a few months now. Lately, we have spared some time to dig into solidifying our client implementation that uses the TL;DRWhat exactly is Our Use CaseOur JetStream servers run on Kubernetes as a 3-instance cluster. Our client code publishes messages through Line 36 in 6c6add8 We intend to use a retry logic here when client cannot publish for some reason. Below is our intended use: // jsc is the acronym for our client object
opts := []nats.PubOpt{
nats.MsgId(jsc.nuid.Next()),
nats.RetryWait(time.Second), // 1-second wait between retry attempts
nats.RetryAttempts(-1), // unlimited retry-attempts
nats.Context(ctx), // a context with a deadline that controls the overall max duration of the Publish call
}
if _, err := jsc.js.Publish(topic, value, opts...); err != nil {
return fmt.Errorf("error producing message: %v", err)
} When tested with a network controller (Network Link Conditioner for our case), this call yields the following result:
ConclusionBased on the above observation, I can conclude that the internal RequestMsgWithContext has some sort of retry logic because it delivers the message successfully when some of the packets are dropped. However, we don't quite understand other possible errors. For instance, what is Thanks to everyone in advance 🙏🏻. I'd be glad to provide any more details. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The client would get a |
Beta Was this translation helpful? Give feedback.
The client would get a
ErrNoResponders
error whenever the servers has not mounted yet the JetStream API in the server to serve a stream (for example during boot). The same would happen if the stream does not exist, since there is no JetStream API NATS subject ready for the client to send requests to in order to persists messages from that stream, so this also becomes aErrNoResponders
error.