kafka

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = types.Module{
	{CreateFunc: NewKafka},
	{CreateFunc: CreateConfig},
}

Functions

func AddTypedHandler added in v1.0.23

func AddTypedHandler[T any](
	cg ConsumerGroup,
	topic common.Topic,
	f common.MessageHandlerTyped[T],
) error

func CreateConfig

func CreateConfig(cfg *config.Config) common.Config

func TypedSend added in v1.0.24

func TypedSend[T any](
	sp SyncProducer,
	topic string,
	message T,
	opts ...syncproducer.SendOptions,
) error

Types

type ConsumerGroup

type ConsumerGroup interface {
	AddHandler(topic common.Topic, hm common.MessageHandler) error
	Consume() error
	Close() error
	PauseAll()
	ResumeAll()
}

type Kafka

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

func NewKafka

func NewKafka(cfg common.Config, logger *zap.Logger) *Kafka

func (*Kafka) NewConsumerGroup

func (k *Kafka) NewConsumerGroup(nameGroup string, opts ...consumergroup.ConsumerGroupOption) (ConsumerGroup, error)

func (*Kafka) NewSyncProducer

func (k *Kafka) NewSyncProducer(opts ...syncproducer.SyncProducerOption) (SyncProducer, error)

type SyncProducer

type SyncProducer interface {
	Send(topic string, message []byte, opts ...syncproducer.SendOptions) error
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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