broker

package
v0.0.0-...-3d8a049 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartConsuming

func StartConsuming(
	ctx context.Context,
	cfg config.Kafka,
	consumeFunction ConsumeFunction,
	logger *zap.Logger,
) error

Types

type ConsumeFunction

type ConsumeFunction func(ctx context.Context, message *sarama.ConsumerMessage) error

type Consumer

type Consumer interface {
	sarama.ConsumerGroupHandler
}

type Message

type Message struct {
	Type  MessageType
	Value map[string]interface{}
}

type MessageType

type MessageType uint16
const (
	Create MessageType = iota
	Update
	Remove
)

type Producer

type Producer interface {
	CreateBasket(basket *model.Basket)
	UpdateBasket(basket *model.Basket)
	RemoveBasket(basketID uint64)
}

func NewProducer

func NewProducer(
	ctx context.Context,
	cfg *config.Kafka,
	logger *zap.Logger,
) (
	Producer,
	error,
)

Jump to

Keyboard shortcuts

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