kafka

package
v0.0.0-...-1ffe831 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConsumer

func RegisterConsumer(
	ctx context.Context,
	handler MessageHandler,
	kafkaBrokers []string,
	topic string,
) error

Types

type Consumer

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

func NewConsumer

func NewConsumer(_ context.Context, brokers []string, topicName string) (*Consumer, error)

func (*Consumer) Close

func (c *Consumer) Close() error

func (*Consumer) Consume

func (c *Consumer) Consume() <-chan *sarama.ConsumerMessage

type MessageHandler

type MessageHandler interface {
	Consume(ctx context.Context, msg []byte) error
}

type Producer

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

func NewProducer

func NewProducer(ctx context.Context, kafkaBrokers []string) (*Producer, error)

func (*Producer) Close

func (p *Producer) Close() error

func (*Producer) ProduceMessage

func (p *Producer) ProduceMessage(topic string, messageBytes []byte)

Jump to

Keyboard shortcuts

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