producer

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: 6 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 {
	AsyncClose()
	Close() error
	Input() chan<- *sarama.ProducerMessage
	Successes() <-chan *sarama.ProducerMessage
	Errors() <-chan *sarama.ProducerError
}

Adapter is the Kafka-Producer interface

type Config

type Config struct {
	ErrHandler   func(*sarama.ProducerError)
	KafkaBrokers []string
	// Allow overwriting default sarama-config
	SaramaConfig *sarama.Config
}

Config wraps configuration for producer

type Producer

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

Producer wraps sarama's producer

func New

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

New returns a configured sarama Kafka-AsyncProducer instance

func (*Producer) Close

func (p *Producer) Close() chan error

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

func (*Producer) CreateKeyMessage

func (p *Producer) CreateKeyMessage(topic string, key string, value string) *sarama.ProducerMessage

CreateKeyMessage creates producer-formatted message with key

func (*Producer) CreateMessage

func (p *Producer) CreateMessage(topic string, value string) *sarama.ProducerMessage

CreateMessage creates keyless producer-formatted message

func (*Producer) EnableLogging

func (p *Producer) EnableLogging()

EnableLogging logs events to console

func (*Producer) Get

func (p *Producer) Get() *Adapter

Get returns the original Sarama Kafka producer

func (*Producer) Input

func (p *Producer) Input() (chan<- *sarama.ProducerMessage, error)

Input takes Kafka messages to be produced

func (*Producer) IsClosed

func (p *Producer) IsClosed() bool

IsClosed returns a bool specifying if Kafka producer is closed

Jump to

Keyboard shortcuts

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