Skip to content

Commit

Permalink
feat: expose ScheduleAt (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
serbrech authored Jun 16, 2022
1 parent d65005e commit 5dc3625
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion common/options/publisheropts/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,25 @@ func SetDefaultHeader(headerName, msgKey string) ManagementOption {
}
}

// SetDefaultHeader adds a header to every message published using the value specified from the message body
// SetMessageMarshaller sets the message marshaller for this publisher. defaults to json.
func SetMessageMarshaller(marshaller marshal.Marshaller) ManagementOption {
return func(p common.Publisher) error {
p.SetMarshaller(marshaller)
return nil
}
}

// SetScheduleAt schedules a message in the future
func SetScheduleAt(t time.Time) Option {
return func(msg *servicebus.Message) error {
if msg == nil {
return errors.New("message is nil. cannot set schedule at")
}
msg.ScheduleAt(t)
return nil
}
}

// SetMessageDelay schedules a message in the future
func SetMessageDelay(delay time.Duration) Option {
return func(msg *servicebus.Message) error {
Expand Down

0 comments on commit 5dc3625

Please sign in to comment.