easykafka

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 8 Imported by: 0

README

go-easykafka

easy to use kafka

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyClosed = errors.New("producer already closed")
)

errors defined

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Marshal(interface{}) ([]byte, error)
}
var DefaultCodec Codec = jsonCodec{}

type ConsumHandler

type ConsumHandler struct {
}

ConsumHandler ...

func (*ConsumHandler) Cleanup

Cleanup ..

func (*ConsumHandler) ConsumeClaim

ConsumeClaim ..

func (*ConsumHandler) Setup

Setup ..

type Consumer

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

Consumer ...

func NewConsumer

func NewConsumer(hosts, topics []string, groupName string, options ...Option) (*Consumer, error)

NewConsumer ...

func (*Consumer) Close

func (c *Consumer) Close()

Close ...

func (*Consumer) Run

func (c *Consumer) Run()

Run ...

func (*Consumer) SetHandler

func (c *Consumer) SetHandler(h sarama.ConsumerGroupHandler)

SetHandler ...

type Option

type Option func(*sarama.Config)

type Producer

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

Producer ...

func NewProducer

func NewProducer(hosts []string, options ...Option) (*Producer, error)

NewProducer ...

func (*Producer) Close

func (p *Producer) Close() error

Close ...

func (*Producer) Publish

func (p *Producer) Publish(topic string, data interface{}) error

Publish ...

func (*Producer) PublishRaw

func (p *Producer) PublishRaw(msg *sarama.ProducerMessage) error

PublishRaw ...

func (*Producer) PublishString

func (p *Producer) PublishString(topic, message string) error

PublishString ...

func (*Producer) SetCodec

func (p *Producer) SetCodec(codec Codec)

SetCodec ...

Jump to

Keyboard shortcuts

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