easykafka

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 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")
	ErrGroupNotFound = errors.New("group not found")
)

errors defined

Functions

This section is empty.

Types

type AckFunc added in v1.1.0

type AckFunc func(*sarama.ProducerMessage)

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 {
	Topics    []string
	Reconnect time.Duration
	// 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() error

Close ...

func (*Consumer) DeleteGroup added in v1.0.1

func (c *Consumer) DeleteGroup() error

func (*Consumer) Group added in v1.0.2

func (c *Consumer) Group() string

func (*Consumer) Run

func (c *Consumer) Run(handler sarama.ConsumerGroupHandler)

Run ...

type ErrFunc added in v1.1.0

type ErrFunc func(*sarama.ProducerError)

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) GetAsyncProducer added in v1.1.0

func (p *Producer) GetAsyncProducer() sarama.AsyncProducer

GetAsyncProducer ...

func (*Producer) Publish

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

Publish ...

func (*Producer) PublishRawMsg added in v1.0.1

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

PublishRawMsg ...

func (*Producer) PublishString

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

PublishString ...

func (*Producer) SetCodec

func (p *Producer) SetCodec(codec Codec)

SetCodec ...

func (*Producer) SetError added in v1.1.0

func (p *Producer) SetError(errFunc ErrFunc)

SetError ...

func (*Producer) SetSuccess added in v1.1.0

func (p *Producer) SetSuccess(ackFunc AckFunc)

SetSuccess ...

Jump to

Keyboard shortcuts

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