kafkaclient

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package kafkaclient provides factory functions for creating Kafka readers and writers using github.com/segmentio/kafka-go.

Reader

reader := kafkaclient.NewReader(kafkaclient.ReaderConfig{
    Brokers: []string{"localhost:9092"},
    Topic:   "example-topic",
    GroupID: "example-group",
})
defer reader.Close()

Writer

writer := kafkaclient.NewWriter(kafkaclient.WriterConfig{
    Brokers: []string{"localhost:9092"},
    Topic:   "example-topic",
})
defer writer.Close()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(cfg ReaderConfig) *kafka.Reader

func NewWriter

func NewWriter(cfg WriterConfig) *kafka.Writer

Types

type ReaderConfig

type ReaderConfig struct {
	Brokers     []string
	Topic       string
	GroupID     string
	Partition   int
	MinBytes    int
	MaxBytes    int
	StartOffset int64
}

type WriterConfig

type WriterConfig struct {
	Brokers          []string
	Topic            string
	Async            bool
	RequiredAcks     kafka.RequiredAcks
	Balancer         kafka.Balancer
	BatchSize        int
	BatchBytes       int
	BatchTimeout     time.Duration
	CompressionCodec kafka.CompressionCodec
	MaxAttempts      int
}

Jump to

Keyboard shortcuts

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