kafka

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 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 Event

type Event func(*sarama.ConsumerMessage)

消费者消息事件

type KafkaConfig

type KafkaConfig struct {
	Enable           bool     `mapstructure:"enable" json:"enable" yaml:"enable"`                                 // 是否开启
	Partition        int32    `mapstructure:"partition" json:"partition" yaml:"partition"`                        // 分区
	EncoderKey       string   `mapstructure:"encoder-key" json:"encoderKey" yaml:"encoder-key"`                   // 编码key
	BootstrapServers []string `mapstructure:"bootstrap-servers" json:"bootstrapServers" yaml:"bootstrap-servers"` // kafka节点服务器
}

func (KafkaConfig) Load

func (c KafkaConfig) Load()

type Msg

type Msg struct {
	Topic   string
	Message string
}

生产

func (Msg) SendMessage

func (m Msg) SendMessage() (int32, int64, error)

生产者发布消息

type Sub

type Sub struct {
	Topic string
	Event Event
}

订阅

func (Sub) Subcribe

func (s Sub) Subcribe() (err error)

Jump to

Keyboard shortcuts

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