Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMaxConnectAttempts = errors.New("max connection attempts reached")
ErrMaxConnectAttempts is thrown when the maximum number of reconnect attempts is reached.
Logger is the logger for the worker
var MaxReconnectAttempts = 10
MaxReconnectAttempts is the maximum number of times we should reconnect to a server
Functions ¶
This section is empty.
Types ¶
type Mail ¶
type Mail interface { Backoff(reason error) error Error(err error) error Success() error Generate(msg *gomail.Message) error GetDialer() (Dialer, error) }
Mail is an interface that handles the common operations for email messages
type MailWorker ¶
type MailWorker struct {
Queue chan []Mail
}
MailWorker is the worker that receives slices of emails on a channel to send. It's assumed that every slice of emails received is meant to be sent to the same server.
var Mailer *MailWorker
Mailer is a global instance of the mailer that can be used in applications. It is the responsibility of the application to call Mailer.Start()
func NewMailWorker ¶
func NewMailWorker() *MailWorker
NewMailWorker returns an instance of MailWorker with the mail queue initialized.
func (*MailWorker) Start ¶
func (mw *MailWorker) Start(ctx context.Context)
Start launches the mail worker to begin listening on the Queue channel for new slices of Mail instances to process.