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

Function WithMsgTTL

jetstream/jetstream_options.go:612–617  ·  view source on GitHub ↗

WithMsgTTL sets per msg TTL. Requires [StreamConfig.AllowMsgTTL] to be enabled.

(dur time.Duration)

Source from the content-addressed store, hash-verified

610// WithMsgTTL sets per msg TTL.
611// Requires [StreamConfig.AllowMsgTTL] to be enabled.
612func WithMsgTTL(dur time.Duration) PublishOpt {
613 return func(opts *pubOpts) error {
614 opts.ttl = dur
615 return nil
616 }
617}
618
619// WithExpectStream sets the expected stream the message should be published to.
620// If the message is published to a different stream server will reject the

Callers 4

TestPublishWithTTLFunction · 0.92
TestPublishAsyncWithTTLFunction · 0.92
updateRevisionMethod · 0.85
DeleteMethod · 0.85

Calls

no outgoing calls

Tested by 2

TestPublishWithTTLFunction · 0.74
TestPublishAsyncWithTTLFunction · 0.74