WithScheduleTTL sets the TTL on messages generated by the scheduler. Requires [StreamConfig.AllowMsgTTL] to be enabled on the stream.
(d time.Duration)
| 786 | // WithScheduleTTL sets the TTL on messages generated by the scheduler. |
| 787 | // Requires [StreamConfig.AllowMsgTTL] to be enabled on the stream. |
| 788 | func WithScheduleTTL(d time.Duration) PublishOpt { |
| 789 | return func(opts *pubOpts) error { |
| 790 | if d <= 0 { |
| 791 | return fmt.Errorf("%w: schedule TTL must be greater than 0", ErrInvalidOption) |
| 792 | } |
| 793 | opts.scheduleTTL = d.String() |
| 794 | return nil |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | // WithScheduleTTLNever marks messages generated by the scheduler as never |
| 799 | // expiring. This overrides the stream's MaxAge for delivered messages. |