kafka

package
v0.9.19 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConf added in v0.9.18

func ValidateConf(kconf conf.KafkaConf) (err error)

ValidateConf validates supplied configuration

Types

type Client added in v0.9.18

type Client interface {
	NewProducer(Common) (Producer, error)
	NewConsumer(Common) (Consumer, error)
	Brokers() []*sarama.Broker
}

Client is the kafka client

type Common added in v0.9.18

type Common interface {
	ValidateConf() error
	Start() error
	Conf() conf.KafkaConf
	Producer() Producer
}

Common is the base interface for bridges that interact with Kafka

func NewKafkaCommon

func NewKafkaCommon(kf Factory, conf conf.KafkaConf, kafkaGoRoutines GoRoutines) (k Common)

NewKafkaCommon constructs a new Common instance

type Consumer added in v0.9.18

type Consumer interface {
	Close() error
	Messages() <-chan *sarama.ConsumerMessage
	Errors() <-chan error
	MarkOffset(*sarama.ConsumerMessage, string)
}

Consumer provides the interface passed from KafkaCommon to consume messages

type Factory added in v0.9.18

type Factory interface {
	NewClient(Common, *sarama.Config) (Client, error)
}

Factory builds new clients

type GoRoutines added in v0.9.18

type GoRoutines interface {
	ConsumerMessagesLoop(consumer Consumer, producer Producer, wg *sync.WaitGroup)
	ProducerErrorLoop(consumer Consumer, producer Producer, wg *sync.WaitGroup)
	ProducerSuccessLoop(consumer Consumer, producer Producer, wg *sync.WaitGroup)
}

GoRoutines defines goroutines for processing Kafka messages from KafkaCommon

type Producer added in v0.9.18

type Producer interface {
	AsyncClose()
	Input() chan<- *sarama.ProducerMessage
	Successes() <-chan *sarama.ProducerMessage
	Errors() <-chan *sarama.ProducerError
}

Producer provides the interface passed from KafkaCommon to produce messages (subset of sarama)

type SaramaKafkaFactory

type SaramaKafkaFactory struct{}

SaramaKafkaFactory - uses sarama

func (*SaramaKafkaFactory) NewClient

func (f *SaramaKafkaFactory) NewClient(k Common, clientConf *sarama.Config) (c Client, err error)

NewClient - returns a new client

Jump to

Keyboard shortcuts

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