kafka

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTopicExist

func IsTopicExist(err error) bool

IsTopicExist returns whether an error is caused by a topic already existing.

func NewLeastBytesPartitioner added in v1.1.0

func NewLeastBytesPartitioner(topic string) sarama.Partitioner

NewLeastBytesPartitioner function takes topic as an argument, but it is not used. This has been done as it implements the sarama.PartitionerConstructor interface which requires it.

Types

type Consumer

type Consumer interface {
	Fetch(context.Context) (Message, error)
	Commit(context.Context, Message) error
	GroupMode() bool
	Close() error
}

Consumer represents a Kafka Consumer.

func NewConsumer

func NewConsumer(cc conf.ConnectorConfig, dialTimeout time.Duration) (Consumer, error)

NewConsumer returns a new Kafka Consumer.

type Manager

type Manager interface {
	CreateTopic(topic string, partitions, replication int) error
	Close() error
}

Manager represents an object that can manage Kafka Producers and Consumers.

func NewManager

NewManager returns a Kafka Manager.

type Message

type Message struct {
	Topic     string
	Partition int
	Offset    int64

	Key   []byte
	Value []byte
}

Message represents a Kafka message.

type Producer

type Producer interface {
	Write(Message) error
	Close() error
}

Producer represents a Kafka producer.

func NewErroredProducer

func NewErroredProducer(err error) Producer

NewErroredProducer returns a Producer that fails when any methods are called.

func NewProducer

func NewProducer(cc conf.ConnectorConfig, bc conf.NATSKafkaBridgeConfig, topic string) (Producer, error)

NewProducer returns a new Kafka Producer.

Jump to

Keyboard shortcuts

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