consumer

package
v0.0.0-...-aa78a79 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Close() error
	CommitOffsets() error
	Errors() <-chan error
	HighWaterMarks() map[string]map[int32]int64
	MarkOffset(msg *sarama.ConsumerMessage, metadata string)
	MarkOffsets(s *cluster.OffsetStash)
	MarkPartitionOffset(topic string, partition int32, offset int64, metadata string)
	Messages() <-chan *sarama.ConsumerMessage
	Notifications() <-chan *cluster.Notification
	Partitions() <-chan cluster.PartitionConsumer
	ResetOffset(msg *sarama.ConsumerMessage, metadata string)
	ResetOffsets(s *cluster.OffsetStash)
	ResetPartitionOffset(topic string, partition int32, offset int64, metadata string)
	Subscriptions() map[string][]int32
}

Adapter is the Kafka-Consumer interface

type Config

type Config struct {
	ConsumerGroup string
	ErrHandler    func(*error)
	KafkaBrokers  []string
	MsgHandler    func(*sarama.ConsumerMessage, *Consumer)
	NtfnHandler   func(*cluster.Notification)
	// Allow overwriting default sarama-config
	SaramaConfig *cluster.Config
	Topics       []string
}

Config wraps configuration for consumer

type Consumer

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

Consumer wraps sarama-cluster's consumer

func New

func New(initConfig *Config) (*Consumer, error)

New returns a configured Sarama Kafka-Consumer instance

func (*Consumer) Close

func (c *Consumer) Close() chan error

Close attempts to close the consumer, and returns any occurring errors over channel

func (*Consumer) EnableLogging

func (c *Consumer) EnableLogging()

EnableLogging logs events to console

func (*Consumer) Get

func (c *Consumer) Get() Adapter

Get returns the original Sarama Kafka consumer

func (*Consumer) IsClosed

func (c *Consumer) IsClosed() bool

IsClosed returns a bool specifying if Kafka consumer is closed

Jump to

Keyboard shortcuts

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