MCPcopy
hub / github.com/nats-io/nats.go / WithRetryAttempts

Function WithRetryAttempts

jetstream/jetstream_options.go:689–697  ·  view source on GitHub ↗

WithRetryAttempts sets the retry number of attempts when ErrNoResponders is encountered. Defaults to 2

(num int)

Source from the content-addressed store, hash-verified

687// WithRetryAttempts sets the retry number of attempts when ErrNoResponders is
688// encountered. Defaults to 2
689func WithRetryAttempts(num int) PublishOpt {
690 return func(opts *pubOpts) error {
691 if num < 0 {
692 return fmt.Errorf("%w: retry attempts cannot be negative", ErrInvalidOption)
693 }
694 opts.retryAttempts = num
695 return nil
696 }
697}
698
699// WithStallWait sets the max wait when the producer becomes stall producing
700// messages. If a publish call is blocked for this long, ErrTooManyStalledMsgs

Callers 3

TestPublishMsgAsyncFunction · 0.92
TestPublishAsyncRetryFunction · 0.92

Calls 1

ErrorfMethod · 0.80

Tested by 3

TestPublishMsgAsyncFunction · 0.74
TestPublishAsyncRetryFunction · 0.74