kafka

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package kafka 提供从 Kafka Topic 消费消息的 Source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Brokers Kafka 集群地址列表
	Brokers []string `json:"brokers"`
	// Topic 消费的 Topic
	Topic string `json:"topic"`
	// GroupID 消费者组 ID
	GroupID string `json:"group_id"`
	// Offset 起始位置: newest (最新) 或 oldest (最早)
	Offset string `json:"offset"`
}

Config Source 的配置

type Source

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

Source 从 Kafka Topic 消费消息

func New

func New() *Source

New 创建新的 Source

func (*Source) Close

func (s *Source) Close() error

Close 关闭连接

func (*Source) Init

func (s *Source) Init(config []byte) error

Init 初始化 Source

func (*Source) Read

func (s *Source) Read(ctx context.Context, out chan<- types.Record) (int64, error)

Read 读取 Kafka 消息

Jump to

Keyboard shortcuts

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