kafka

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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
	Headers []sarama.RecordHeader
}

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.

type XDGSCRAMClient added in v1.3.0

type XDGSCRAMClient struct {
	*scram.Client
	*scram.ClientConversation
	scram.HashGeneratorFcn
}

func (*XDGSCRAMClient) Begin added in v1.3.0

func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)

func (*XDGSCRAMClient) Done added in v1.3.0

func (x *XDGSCRAMClient) Done() bool

func (*XDGSCRAMClient) Step added in v1.3.0

func (x *XDGSCRAMClient) Step(challenge string) (response string, err error)

Jump to

Keyboard shortcuts

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