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

Function WithScheduleTarget

jetstream/jetstream_options.go:762–770  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

760// This option is required for scheduled messages.
761// Requires [StreamConfig.AllowMsgSchedules] to be enabled.
762func 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

Calls 1

ErrorfMethod · 0.80