service

package
v0.0.0-...-44efded Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer func(msg Message)

type ConsumerService

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

func NewConsumerService

func NewConsumerService(repo data.CoffeeRepository, nc Subscriber, logger log.Logger) *ConsumerService

func (ConsumerService) GetCoffees

func (c ConsumerService) GetCoffees(msg Message)

func (ConsumerService) RegisterConsumer

func (c ConsumerService) RegisterConsumer(topic string, consumer Consumer)

type Message

type Message interface {
	Respond(data []byte) error
}

type Outbox

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

func NewOutbox

func NewOutbox(db *data.OutboxRepository, p events.Publisher) Outbox

func (*Outbox) Send

func (o *Outbox) Send(ctx context.Context, topic string, message []byte) (string, error)

func (*Outbox) StartBackgroundPolling

func (o *Outbox) StartBackgroundPolling(interval time.Duration) (cancel func())

type ProductService

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

ProductService defines the operations the service supports

func NewCoffeeService

func NewCoffeeService(repo data.CoffeeRepository, outbox *Outbox, logger log.Logger) *ProductService

NewCoffeeService creates a new instance of the coffee service

func (*ProductService) Add

Add adds a new coffee from the json body

func (*ProductService) Get

Get retrieves a coffee by id

func (*ProductService) List

List retrieves a list of coffees

func (*ProductService) RegisterRoutes

func (p *ProductService) RegisterRoutes(r *mux.Router)

type Subscriber

type Subscriber interface {
	SubscribeSync(subj string) (*nats.Subscription, error)
}

Jump to

Keyboard shortcuts

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