daemon

package
v0.0.0-...-8922687 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyType

type BodyType int32
const (
	BodyTypePlain BodyType = iota + 1
	BodyTypeHTML
)

func (BodyType) String

func (b BodyType) String() string

type Daemon

type Daemon struct {
	Queue chan Message
	// contains filtered or unexported fields
}

Daemon orchestrates processing and sending incoming messages

func New

func New(ctx context.Context, backlog int, matchers []*Matcher) *Daemon

New spawns a new sender daemon to process all the incoming messages

func (*Daemon) Shutdown

func (d *Daemon) Shutdown(ctx context.Context) error

Shutdown stops the processing of messages. Any unsent messages will be dropped.

type Format

type Format string
const (
	FormatPlain Format = "PLAIN"
	FormatHTML  Format = "HTML"
)

type Matcher

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

func NewMatcher

func NewMatcher(id string, numWorkers int, provider providers.Provider, pattern string) (*Matcher, error)

NewMatcher creates a new matcher for the provider with its associated queue

func (*Matcher) Enqueue

func (m *Matcher) Enqueue(msg Message)

Enqueue adds the message to the provider's queue

type Message

type Message struct {
	To          []string
	From        string
	Subject     string
	Body        string
	Type        Format
	ReplyTo     *string
	SpanContext trace.SpanContext
}

Message represents an email to be sent to one or more recipients

Jump to

Keyboard shortcuts

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