kafka

package
v0.0.0-...-91eafdd Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Broker string        `json:"broker"`
	Params []TopicParams `json:"params"`
}

type Payload

type Payload struct {
	Status  string       `json:"status"`
	Block   common.Block `json:"block"`
	Version int          `json:"version"`
}

type Reader

type Reader struct {
	Reader *kafka.Reader
}

func NewReader

func NewReader(brokers []string, topic string, groupId string) *Reader

func (*Reader) CommitMessages

func (k *Reader) CommitMessages(ctx context.Context, commits <-chan kafka.Message) error

func (*Reader) FetchMessage

func (k *Reader) FetchMessage(ctx context.Context, messages chan<- kafka.Message) error

type TopicParams

type TopicParams struct {
	Topic     string   `json:"topic"`
	Addresses []string `json:"addresses"`
	Topics    []string `json:"topics"`
}

type Writer

type Writer struct {
	Writer *kafka.Writer
	Params *[]TopicParams
}

func NewWriter

func NewWriter(broker string, params []TopicParams, batchSize int) *Writer

func (*Writer) WriteMessages

func (w *Writer) WriteMessages(ctx context.Context, payload []byte, topic string) error

Jump to

Keyboard shortcuts

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