kafka

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHeaderToMap

func ConvertHeaderToMap(header sarama.RecordHeader) map[string]string

Types

type AsyncProducer

type AsyncProducer struct {
	KafkaVersion sarama.KafkaVersion
	BrokerList   []string
	Config       *sarama.Config
	Client       sarama.Client
	Producer     sarama.AsyncProducer
}

func NewAsyncProducer

func NewAsyncProducer(kafkaVersion string, brokerList []string) (*AsyncProducer, error)

func (*AsyncProducer) BuildProducerMessage

func (p *AsyncProducer) BuildProducerMessage(topicName string, key string, message string, headers []sarama.RecordHeader) *sarama.ProducerMessage

func (*AsyncProducer) BuildProducerMessageHeader

func (p *AsyncProducer) BuildProducerMessageHeader(key string, value string) sarama.RecordHeader

func (*AsyncProducer) Close

func (p *AsyncProducer) Close() error

func (*AsyncProducer) Produce

func (p *AsyncProducer) Produce(topicName string, message interface{}) error

type ConsumerGroup

type ConsumerGroup struct {
	KafkaVersion sarama.KafkaVersion
	BrokerList   []string
	GroupName    string
	Config       *sarama.Config
	Client       sarama.Client
	Group        sarama.ConsumerGroup
}

func NewConsumerGroup

func NewConsumerGroup(kafkaVersion string, brokerList []string, groupName string, initOffset int64) (cg *ConsumerGroup, err error)

func (*ConsumerGroup) Close

func (cg *ConsumerGroup) Close() error

func (*ConsumerGroup) Consume

func (cg *ConsumerGroup) Consume(ctx context.Context, topicName string, handler sarama.ConsumerGroupHandler) (err error)

type DefaultConsumerGroupHandler

type DefaultConsumerGroupHandler struct{}

func (DefaultConsumerGroupHandler) Cleanup

func (DefaultConsumerGroupHandler) ConsumeClaim

func (DefaultConsumerGroupHandler) Setup

Jump to

Keyboard shortcuts

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