inform

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWorkerService

func StartWorkerService(ctx context.Context, data *ServiceData) (<-chan struct{}, error)

StartWorkerService starts the event queue listener service to listen for configured events return channel to track the finish event

to wait sync for the service to finish: fc, err := StartWorkerService(data) handle err <-fc // waits for finish

Types

type EmailMaker

type EmailMaker interface {
	Make(data *inform.Data) (*email.Email, error)
}

EmailMaker prepares the email

type EmailRetriever

type EmailRetriever interface {
	GetEmail(ID string) (string, error)
}

EmailRetriever return the email by ID

type Locker

type Locker interface {
	Lock(id string, lockKey string) error
	UnLock(id string, lockKey string, value *int) error
}

Locker tracks email sending process It is used to quarantee not to send the emails twice

type Sender

type Sender interface {
	Send(email *email.Email) error
}

Sender send emails

type ServiceData

type ServiceData struct {
	TaskName       string
	WorkCh         <-chan amqp.Delivery
	EmailSender    Sender
	EmailMaker     EmailMaker
	EmailRetriever EmailRetriever
	Locker         Locker
	Location       *time.Location
}

ServiceData keeps data required for service work

Jump to

Keyboard shortcuts

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