kafkaHelper

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT-0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncProductMsg

func AsyncProductMsg(topic string, msgs []string)

AsyncProductMsg 是一个异步发送消息到Kafka的函数 topic: 消息的主题 msgs: 需要发送的消息的内容列表

func Send2Topic

func Send2Topic(brokers []string, topic, content string)

同步生产模式

Types

type ConsumerGroupHandler

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

func NewConsumerGroupHandler

func NewConsumerGroupHandler(Brokers []string, GroupId string) *ConsumerGroupHandler

func (*ConsumerGroupHandler) Cleanup

func (*ConsumerGroupHandler) ConsumeClaim

func (*ConsumerGroupHandler) Setup

func (*ConsumerGroupHandler) Subscribe

func (h *ConsumerGroupHandler) Subscribe(topic string, fun func(string) bool)

func (*ConsumerGroupHandler) SubscribeRaw

func (h *ConsumerGroupHandler) SubscribeRaw(topic string, fun func(*sarama.ConsumerMessage) bool)

func (*ConsumerGroupHandler) Worker

func (h *ConsumerGroupHandler) Worker()

type KafkaAsyncProducer

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

func NewKafkaAsyncProducer

func NewKafkaAsyncProducer(brokers []string) *KafkaAsyncProducer

func (*KafkaAsyncProducer) Close

func (p *KafkaAsyncProducer) Close()

func (*KafkaAsyncProducer) Publish

func (p *KafkaAsyncProducer) Publish(topic string, messageBytes []byte)

Jump to

Keyboard shortcuts

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