kafka

package
v0.0.0-...-b9a86dc Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProducer = errors.New("kafka producer nil")
	ErrConsumer = errors.New("kafka consumer nil")
)

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	ConsumerGroup *consumergroup.ConsumerGroup
	// contains filtered or unexported fields
}

kafka consumer

func NewConsumer

func NewConsumer(c *conf.KafkaConsumer) (kc *Consumer)

func (*Consumer) Close

func (c *Consumer) Close() error

type Producer

type Producer struct {
	sarama.AsyncProducer
	sarama.SyncProducer
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(c *conf.KafkaProducer) (p *Producer)

NewProducer new kafka async producer and retry when has error.

func (*Producer) Close

func (p *Producer) Close() (err error)

func (*Producer) Input

func (p *Producer) Input(c context.Context, msg *sarama.ProducerMessage) (err error)

Input send msg to kafka NOTE: If producer has beed created failed, the message will lose.

Jump to

Keyboard shortcuts

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