kafka

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package kafka provides a stub Auditor for Kafka-based audit event delivery. The real implementation will wrap cloudevents-sdk-go/protocol/kafka_sarama/v2; this stub satisfies the interface and returns an error indicating that Kafka support requires the sarama dependency to be configured.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("kafka auditor: not implemented — requires sarama dependency")

ErrNotImplemented is returned by the stub Kafka auditor when Emit is called.

Functions

func NewAuditor

func NewAuditor(cfg Config, opts ...Option) (audit.Auditor, error)

NewAuditor creates a new Kafka-backed Auditor. NOTE: This is currently a stub implementation. The real implementation requires github.com/cloudevents/sdk-go/protocol/kafka_sarama/v2.

Types

type Config

type Config struct {
	// Brokers is the list of Kafka broker addresses.
	Brokers []string

	// Topic is the Kafka topic to produce audit events to.
	Topic string

	// Structured enables CloudEvents structured content mode.
	// Default (false) uses binary content mode.
	Structured bool

	// PartitionKeyFn extracts a partition key from the event.
	// Default: reads event.Extensions()[audit.ExtPartitionKey].
	PartitionKeyFn func(cloudevents.Event) string
}

Config holds Kafka connection and behavior settings.

type Option

type Option func(*Config)

Option configures the Kafka auditor.

func WithPartitionKeyFn

func WithPartitionKeyFn(fn func(cloudevents.Event) string) Option

WithPartitionKeyFn sets a custom function to derive the Kafka partition key.

func WithStructuredMode

func WithStructuredMode() Option

WithStructuredMode switches from binary to structured CloudEvents content mode.

Jump to

Keyboard shortcuts

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