river

package
v0.0.0-...-d54a50e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailClient

type EmailClient interface {
	Send(ctx context.Context, args email.JobArgs) error
}

EmailClient defines the interface for delivering pre-rendered emails

type JobQueue

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

JobQueue wraps the River client for email job processing

func NewJobQueue

func NewJobQueue(db *postgres.DB, client EmailClient) (*JobQueue, error)

NewJobQueue creates a new River-based job queue client

func (*JobQueue) EnqueueEmailJob

func (c *JobQueue) EnqueueEmailJob(ctx context.Context, jobArgs *email.JobArgs) error

EnqueueEmailJob enqueues a pre-rendered email job to the queue

func (*JobQueue) Start

func (c *JobQueue) Start(ctx context.Context) error

Start starts the River job queue workers

func (*JobQueue) Stop

func (c *JobQueue) Stop(ctx context.Context) error

Stop stops the River client gracefully

type SendEmailWorker

type SendEmailWorker struct {
	river.WorkerDefaults[email.JobArgs]
	// contains filtered or unexported fields
}

SendEmailWorker processes email sending jobs from the River queue

func NewSendEmailWorker

func NewSendEmailWorker(client EmailClient) *SendEmailWorker

NewSendEmailWorker creates a new email worker

func (*SendEmailWorker) Work

func (w *SendEmailWorker) Work(ctx context.Context, job *river.Job[email.JobArgs]) error

Work delivers a pre-rendered email via the configured client

Jump to

Keyboard shortcuts

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