kafka

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 8 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 struct {
	// contains filtered or unexported fields
}

Consumer kafka consumer

func NewConsumer

func NewConsumer(config *sarama.Config, logger *log.Logger, topic string, groupID string, brokers []string, handler *ConsumerGroupHandler) *Consumer

NewConsumer create a consumer nolint

func (*Consumer) Consume

func (c *Consumer) Consume()

Consume consume data

func (Consumer) Stop

func (c Consumer) Stop()

Stop close conn

type ConsumerGroupHandler

type ConsumerGroupHandler struct{}

ConsumerGroupHandler represents the sarama consumer group

func (ConsumerGroupHandler) Cleanup

Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited

func (ConsumerGroupHandler) ConsumeClaim

ConsumeClaim must start a consumer loop of ConsumerGroupClaim's Messages(), here is supposed to be what you want to do with the message. In this example the message will be logged with the topic name, partition and message value.

func (ConsumerGroupHandler) Setup

Setup is run before consumer start consuming, is normally used to setup things such as database connections

type Producer

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

Producer kafka producer

func NewProducer

func NewProducer(config *sarama.Config, logger *log.Logger, topic string, brokers []string) *Producer

NewProducer create producer nolint

func (*Producer) Publish

func (p *Producer) Publish(message string)

Publish push data to queue

Jump to

Keyboard shortcuts

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