2021-06-25 09:14:27 +02:00
|
|
|
package storage
|
2021-05-13 08:15:14 +02:00
|
|
|
|
2021-06-25 09:14:27 +02:00
|
|
|
import (
|
2021-09-19 11:59:26 +02:00
|
|
|
"ewintr.nl/gte/internal/task"
|
|
|
|
"ewintr.nl/gte/pkg/msend"
|
2021-06-25 09:14:27 +02:00
|
|
|
)
|
2021-05-13 08:15:14 +02:00
|
|
|
|
|
|
|
type Dispatcher struct {
|
|
|
|
msender msend.MSender
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewDispatcher(msender msend.MSender) *Dispatcher {
|
|
|
|
return &Dispatcher{
|
|
|
|
msender: msender,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-25 09:14:27 +02:00
|
|
|
func (d *Dispatcher) Dispatch(t *task.Task) error {
|
2021-05-13 08:15:14 +02:00
|
|
|
return d.msender.Send(&msend.Message{
|
|
|
|
Subject: t.FormatSubject(),
|
|
|
|
Body: t.FormatBody(),
|
|
|
|
})
|
|
|
|
}
|