Durable defines the consumer name for JetStream durable subscribers. This function will return ErrInvalidConsumerName if the name contains any dot ".".
(consumer string)
| 2518 | // This function will return ErrInvalidConsumerName if the name contains |
| 2519 | // any dot ".". |
| 2520 | func 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. |
no test coverage detected