WithScheduleTarget sets the subject where scheduled messages will be delivered. This option is required for scheduled messages. Requires [StreamConfig.AllowMsgSchedules] to be enabled.
(subject string)
| 760 | // This option is required for scheduled messages. |
| 761 | // Requires [StreamConfig.AllowMsgSchedules] to be enabled. |
| 762 | func WithScheduleTarget(subject string) PublishOpt { |
| 763 | return func(opts *pubOpts) error { |
| 764 | if subject == "" { |
| 765 | return fmt.Errorf("%w: schedule target subject cannot be empty", ErrInvalidOption) |
| 766 | } |
| 767 | opts.scheduleTarget = subject |
| 768 | return nil |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | // WithScheduleSource instructs the scheduler to read the latest message |
| 773 | // from the given subject and republish it on schedule. Used for data |