queue

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailQueue    = "emails"
	EmailSendTask = "email:send"
	MaxRetry      = 3
	TimeOut       = 30 * time.Second
)

Variables

This section is empty.

Functions

func NewQueueMux

func NewQueueMux(
	emailHandler *EmailHandler,
) *asynq.ServeMux

Types

type Consumer

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

func NewQueueConsumer

func NewQueueConsumer(redisAddr string) *Consumer

func (*Consumer) Close

func (c *Consumer) Close()

func (*Consumer) Run

func (c *Consumer) Run(mux *asynq.ServeMux) error

type EmailHandler

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

func NewEmailHandler

func NewEmailHandler(mailerService *email.MailService) *EmailHandler

func (*EmailHandler) SendEmailHandler

func (e *EmailHandler) SendEmailHandler(ctx context.Context, t *asynq.Task) error

type EmailPayload

type EmailPayload struct {
	To      string `json:"to"`
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

func (*EmailPayload) Data

func (e *EmailPayload) Data() ([]byte, error)

type Producer

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

func NewQueueProducer

func NewQueueProducer(redisAddr string) *Producer

func (*Producer) Close

func (p *Producer) Close() error

func (*Producer) SendEmail

func (p *Producer) SendEmail(payload *EmailPayload) error

Jump to

Keyboard shortcuts

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