kafkasubscriber

package
v0.0.0-...-2ba4c8d Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL = 0
	CLOSED = 1
)

Variables

This section is empty.

Functions

func DefaultSubscriberConfig

func DefaultSubscriberConfig() *sarama.Config

func New

func New(consumerOpt ConsumerOption, opts ...Option) easypubsub.Subscriber

Types

type ConsumerOption

type ConsumerOption func(o *consumerOptions)

func Consumer

func Consumer(brokers []string, config *sarama.Config) ConsumerOption

func ConsumerGroup

func ConsumerGroup(brokers []string, groupID string, config *sarama.Config) ConsumerOption

type Option

type Option func(o *options)

func WithLogger

func WithLogger(logger easypubsub.Logger) Option

func WithNackResend

func WithNackResend(maxAttempt uint, backoff backoffutils.BackoffFunc) Option

func WithReconnectBackoff

func WithReconnectBackoff(reconnectBackoff backoffutils.BackoffFunc) Option

func WithUnmarshalMsgFunc

func WithUnmarshalMsgFunc(unmarshalMsgFunc UnmarshalMsgFunc) Option

type Subscriber

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

func (*Subscriber) Close

func (sub *Subscriber) Close() error

func (*Subscriber) String

func (sub *Subscriber) String() string

func (*Subscriber) Subscribe

func (sub *Subscriber) Subscribe(ctx context.Context, topic string) (<-chan *easypubsub.Message, <-chan error)

type UnmarshalMsgFunc

type UnmarshalMsgFunc func(ctx context.Context, topic string, kafkaMsg *sarama.ConsumerMessage) (msg *easypubsub.Message, err error)

Jump to

Keyboard shortcuts

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