kafka

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MIT Imports: 9 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 struct {
	Brokers           []string
	ConsumerGroupName string
	ConsumerTopics    []string
	ProducerTopic     string
}

Adapter allows conveniently connecting to Kafka, and creates required Topics and channels for Kafka-communication.

func (*Adapter) InitIO

func (ka *Adapter) InitIO() (*IO, error)

InitIO initializes KafkaIO from the configuration provided to KafkaAdapter. It is necessary that both consumer and producer are properly setup, to enable response for every request. Else this operation will be marked as failed, and the service won't run.

type IO

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

IO provides channels for interacting with Kafka. Note: All receive-channels must be read from to prevent deadlock.

func (*IO) ConsumerErrors

func (kio *IO) ConsumerErrors() <-chan error

ConsumerErrors returns send-channel where consumer errors are published.

func (*IO) ConsumerMessages

func (kio *IO) ConsumerMessages() <-chan *sarama.ConsumerMessage

ConsumerMessages returns send-channel where consumer messages are published.

func (*IO) MarkOffset

func (kio *IO) MarkOffset() chan<- *sarama.ConsumerMessage

MarkOffset marks the consumer message-offset to be committed. This should be used once a message has done its job.

func (*IO) ProducerErrors

func (kio *IO) ProducerErrors() <-chan *sarama.ProducerError

ProducerErrors returns send-channel where producer errors are published.

func (*IO) ProducerInput

func (kio *IO) ProducerInput() chan<- *model.KafkaResponse

ProducerInput returns receive-channel where kafka-responses can be produced.

Jump to

Keyboard shortcuts

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