kafka

package
v0.0.0-...-eb082ec Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyCreated keyEventType = "created"
	KeyUpdated keyEventType = "updated"
	KeyDeleted keyEventType = "deleted"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	GroupId  string
	Broker   string
	Username string
	Password string
	Logger   *zap.Logger
}

type Kafka

type Kafka struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Kafka, error)

func (*Kafka) Close

func (k *Kafka) Close() error

func (*Kafka) ProduceKeyEvent

func (k *Kafka) ProduceKeyEvent(ctx context.Context, eventType keyEventType, keyId, keyHash string) error

func (*Kafka) RegisterOnKeyEvent

func (k *Kafka) RegisterOnKeyEvent(handler func(ctx context.Context, e KeyEvent) error)

func (*Kafka) Start

func (k *Kafka) Start()

Call Start in a goroutine

type KeyEvent

type KeyEvent struct {
	Type keyEventType `json:"type"`
	Key  struct {
		Id   string `json:"id"`
		Hash string `hson:"hash"`
	} `json:"key"`
}

Jump to

Keyboard shortcuts

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