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

Function Durable

js.go:2520–2535  ·  view source on GitHub ↗

Durable defines the consumer name for JetStream durable subscribers. This function will return ErrInvalidConsumerName if the name contains any dot ".".

(consumer string)

Source from the content-addressed store, hash-verified

2518// This function will return ErrInvalidConsumerName if the name contains
2519// any dot ".".
2520func Durable(consumer string) SubOpt {
2521 return subOptFn(func(opts *subOpts) error {
2522 if opts.cfg.Durable != _EMPTY_ {
2523 return errors.New("nats: option Durable set more than once")
2524 }
2525 if opts.consumer != _EMPTY_ && opts.consumer != consumer {
2526 return fmt.Errorf("nats: duplicate consumer names (%s and %s)", opts.consumer, consumer)
2527 }
2528 if err := checkConsumerName(consumer); err != nil {
2529 return err
2530 }
2531
2532 opts.cfg.Durable = consumer
2533 return nil
2534 })
2535}
2536
2537// DeliverAll will configure a Consumer to receive all the
2538// messages from a Stream.

Callers 1

PullSubscribeMethod · 0.85

Calls 3

subOptFnFuncType · 0.85
checkConsumerNameFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected