kafka

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "kafka"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enable  bool   `env:"KAFKA_ENABLE" default:"false" yaml:"enable"`
	Brokers string `env:"KAFKA_BROKERS" default:"localhost:9092" yaml:"brokers"`
}

type Message added in v1.16.0

type Message struct {
	Topic         string
	Partition     int
	Offset        int64
	HighWaterMark int64
	Key           []byte
	Value         []byte
	Time          time.Time
}

type Meta

type Meta struct {
	ID        string    `json:"id" yaml:"id"`
	Name      string    `json:"name" yaml:"name"`
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`
	Version   string    `json:"version" yaml:"version"`
}

func NewMeta

func NewMeta(name string, version string) Meta

type MetricsWriter

type MetricsWriter interface {
	AddCounter(name string, count float64, help string)
}

type Plugin

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

func New

func New() *Plugin

func (*Plugin) Boot

func (p *Plugin) Boot(conf interface{}, dependencies ...interface{}) plugins.Plugin

func (*Plugin) Close

func (p *Plugin) Close() error

func (*Plugin) EnableMetrics

func (p *Plugin) EnableMetrics(metrics MetricsWriter)

func (*Plugin) IsEnabled

func (p *Plugin) IsEnabled() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) ReadFromTopic

func (p *Plugin) ReadFromTopic(topic string, consumerGroupID string, messageC chan<- Message)

func (*Plugin) ReadFromTopicEnd added in v1.18.1

func (p *Plugin) ReadFromTopicEnd(topic string, consumerGroupID string, messageC chan<- Message)

func (*Plugin) ReadFromTopicWithContext added in v1.10.0

func (p *Plugin) ReadFromTopicWithContext(ctx context.Context, topic string, consumerGroupID string, useLastOffset bool, messageC chan<- Message)

func (*Plugin) Start

func (p *Plugin) Start() error

func (*Plugin) WriteToTopic

func (p *Plugin) WriteToTopic(topic string, key string, value string) error

func (*Plugin) WriteToTopicAsync added in v1.19.0

func (p *Plugin) WriteToTopicAsync(topic string, key string, value string)

Jump to

Keyboard shortcuts

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