kafka

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAsyncProducer

func NewAsyncProducer(c Config) (sarama.AsyncProducer, error)

NewAsyncProducer returns an asynchronous kafka producer using the sarama package.

Types

type Config

type Config struct {
	BootstrapServers []string
	Username         string
	Password         string
	Topic            string
}

type Service

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

Service wraps a sarama.AsyncProducer to create a generators.Publisher that can be used with generators.Engine

func New

func New(c Config) (*Service, error)

New returns a Service object which can be used as a datagen.Publisher

func (*Service) Close

func (s *Service) Close() error

func (*Service) Errors

func (s *Service) Errors() <-chan *sarama.ProducerError

Errors is the error output channel back to the user. You MUST read from this channel or the Producer will deadlock when the channel is full. Alternatively, you can set Producer.Return.Errors in your config to false, which prevents errors to be returned.

func (*Service) Publish

func (s *Service) Publish(b []byte)

func (*Service) Successes

func (s *Service) Successes() <-chan *sarama.ProducerMessage

Successes is the success output channel back to the user when Return.Successes is enabled. If Return.Successes is true, you MUST read from this channel or the Producer will deadlock. It is suggested that you send and read messages together in a single select statement.

Jump to

Keyboard shortcuts

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