InactiveThreshold indicates how long the server should keep a consumer after detecting a lack of activity. In NATS Server 2.8.4 and earlier, this option only applies to ephemeral consumers. In NATS Server 2.9.0 and later, this option applies to both ephemeral and durable consumers, allowing durable
(threshold time.Duration)
| 2782 | // consumers to also be deleted automatically after the inactivity threshold has |
| 2783 | // passed. |
| 2784 | func InactiveThreshold(threshold time.Duration) SubOpt { |
| 2785 | return subOptFn(func(opts *subOpts) error { |
| 2786 | if threshold < 0 { |
| 2787 | return fmt.Errorf("invalid InactiveThreshold value (%v), needs to be greater or equal to 0", threshold) |
| 2788 | } |
| 2789 | opts.cfg.InactiveThreshold = threshold |
| 2790 | return nil |
| 2791 | }) |
| 2792 | } |
| 2793 | |
| 2794 | // ConsumerReplicas sets the number of replica count for a consumer. |
| 2795 | func ConsumerReplicas(replicas int) SubOpt { |