kafkaservice

package
v0.0.0-...-49cb14a Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KafkaConfigs

type KafkaConfigs struct {
	Server           string
	GroupId          string
	AutoOffsetReset  string
	EnableAutoCommit bool
}

type KafkaWorker

type KafkaWorker struct {
	sync.RWMutex
	*kafka.Consumer
	*kafka.Producer
	Configs    *config.Kafka
	IsConsumer bool
	IsProducer bool
}

func NewKafkaWorker

func NewKafkaWorker(cfg *config.Kafka) (*KafkaWorker, error)

NewKafkaWorker creates a new KafkaWorker and returns it with an error message.

func (*KafkaWorker) ConfigureConsumer

func (k *KafkaWorker) ConfigureConsumer() error

ConfigureConsumer makes the KafkaWorker a consumer

func (*KafkaWorker) ConfigureProducer

func (k *KafkaWorker) ConfigureProducer() error

ConfigureProducer makes the KafkaWorker a producer

func (*KafkaWorker) ConfigurePubSub

func (k *KafkaWorker) ConfigurePubSub() error

func (*KafkaWorker) SubscribeTopics

func (k *KafkaWorker) SubscribeTopics(topics []string) error

SubscribeTopics subscribes to a given list of topics for consuming

type PubSubWorker

type PubSubWorker interface {
	ConfigureConsumer() error
	ConfigureProducer() error
	ConfigurePubSub() error
	SubscribeTopics(topics []string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳