consumer

package
v0.0.0-...-0eaf191 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CONSUMER string = "kafkaconsumer"

Variables

This section is empty.

Functions

This section is empty.

Types

type KafkaConsumer

type KafkaConsumer struct {
	Opts *Opts

	MySql             *mysql.MySqlDatabase
	MySqlOtelEnricher *otelmysql.MySqlEnricher

	Redis             *redis.RedisDatabase
	RedisOtelEnricher *otelredis.RedisEnricher
	// contains filtered or unexported fields
}

func New

func New(
	log *logger.Logger,
	rdb *redis.RedisDatabase,
	db *mysql.MySqlDatabase,
	optFuncs ...OptFunc,
) *KafkaConsumer

Create a kafka consumer instance

func (*KafkaConsumer) StartConsumerGroup

func (k *KafkaConsumer) StartConsumerGroup(
	ctx context.Context,
) error

type OptFunc

type OptFunc func(*Opts)

func WithBrokerAddress

func WithBrokerAddress(address string) OptFunc

Configure Kafka broker address

func WithBrokerTopic

func WithBrokerTopic(topic string) OptFunc

Configure Kafka broker topic

func WithConsumerGroupId

func WithConsumerGroupId(groupId string) OptFunc

Configure Kafka consumer group ID

func WithServiceName

func WithServiceName(serviceName string) OptFunc

Configure service name of consumer

type Opts

type Opts struct {
	ServiceName     string
	BrokerAddress   string
	BrokerTopic     string
	ConsumerGroupId string
}

Jump to

Keyboard shortcuts

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