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

Function InactiveThreshold

js.go:2784–2792  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2782// consumers to also be deleted automatically after the inactivity threshold has
2783// passed.
2784func 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.
2795func ConsumerReplicas(replicas int) SubOpt {

Callers

nothing calls this directly

Calls 2

subOptFnFuncType · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected