kafka

package
Version: v0.0.0-...-67873a1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BSerialize

func BSerialize(v interface{}) ([]byte, error)

BSerialize, use bytesPool

Types

type Consumer

type Consumer struct {
	Consumer sarama.Consumer
	Topic    string
}

Consumer 消费者

func NewConsumer

func NewConsumer(addrs []string, topic string) (*Consumer, error)

func NewConsumerWithLog

func NewConsumerWithLog(addrs []string, topic string, logPath string) (*Consumer, error)

NewProducer creates kafka async producer

func (*Consumer) StartConsume

func (c *Consumer) StartConsume()

type Producer

type Producer struct {
	Producer sarama.AsyncProducer
	Topic    string
}

Producer represents the kafka async producer

func NewProducer

func NewProducer(addrs []string, topic string, clientID string) (*Producer, error)

NewProducer creates kafka async producer

func NewProducerWithLog

func NewProducerWithLog(addrs []string, topic string, clientID string, logPath string) (*Producer, error)

NewProducer creates kafka async producer

func (*Producer) SendWithKey

func (p *Producer) SendWithKey(key string, msg interface{})

send message with key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL