kconsumer

package
v2.7.8 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPollTimeout = 100 * time.Millisecond

The default time that the kafka consumer polls for a new message before it checks the context for cancellation.

Functions

This section is empty.

Types

type HandleMessage

type HandleMessage func(ctx context.Context, msg *kafka.Message) error

HandleMessage is the user-provided function called for each consumed message. It receives the raw *kafka.Message so the caller has access to key, headers, and partition/offset metadata.

type PartitionConsumer

type PartitionConsumer struct {
	Topics   []string
	Consumer *kafka.Consumer
}

PartitionConsumer subscribes to a topic and runs a dedicated goroutine per assigned partition. Offset storage is explicit: only messages that were successfully handled are stored for auto-commit.

If you return an error from your handler, you get two retries before the consumer will quit and shutdown with an error.

func (*PartitionConsumer) Consume

func (c *PartitionConsumer) Consume(ctx context.Context, handle HandleMessage) error

Jump to

Keyboard shortcuts

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