msgconsumer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package msgconsumer reads and sends SMS/Email messages from a repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigOption

type ConfigOption func(*service)

ConfigOption configures the service.

func WithLogger

func WithLogger(l log.Logger) ConfigOption

WithLogger configures the service with a logger.

func WithWorkers

func WithWorkers(w int) ConfigOption

WithWorkers determines the total number of workers to process a message queue.

type Consumer

type Consumer interface {
	Run(ctx context.Context) error
}

Consumer reads a message stream from a repository.

func NewService

func NewService(r auth.MessageRepository, smsLib SMSer, emailLib Emailer, options ...ConfigOption) Consumer

NewService returns a new Consumer

type Emailer

type Emailer interface {
	Email(ctx context.Context, email string, message string) error
}

Emailer exposes an API to send email messages.

type SMSer

type SMSer interface {
	SMS(ctx context.Context, phoneNumber string, message string) error
}

SMSer exposes an API to send SMS messages.

Jump to

Keyboard shortcuts

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