worker

package
Version: v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 6 Imported by: 20

Documentation

Overview

Package worker contains the functionality for the background worker process. It starts a background service that polls every minute for scheduled campaigns to be launched. If a campaign is found, it gathers the maillogs associated with the campaign and sends them to the mailer package to be processed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMailer added in v0.9.0

func WithMailer(m mailer.Mailer) func(*DefaultWorker) error

WithMailer sets the mailer for a given worker. By default, workers use a standard, default mailworker.

Types

type DefaultWorker added in v0.9.0

type DefaultWorker struct {
	// contains filtered or unexported fields
}

DefaultWorker is the background worker that handles watching for new campaigns and sending emails appropriately.

func (*DefaultWorker) LaunchCampaign added in v0.9.0

func (w *DefaultWorker) LaunchCampaign(c models.Campaign)

LaunchCampaign starts a campaign

func (*DefaultWorker) SendTestEmail added in v0.9.0

func (w *DefaultWorker) SendTestEmail(s *models.EmailRequest) error

SendTestEmail sends a test email

func (*DefaultWorker) Start added in v0.9.0

func (w *DefaultWorker) Start()

Start launches the worker to poll the database every minute for any pending maillogs that need to be processed.

type Worker

type Worker interface {
	Start()
	LaunchCampaign(c models.Campaign)
	SendTestEmail(s *models.EmailRequest) error
}

Worker is an interface that defines the operations needed for a background worker

func New

func New(options ...func(Worker) error) (Worker, error)

New creates a new worker object to handle the creation of campaigns

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL