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 ¶
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.
Click to show internal directories.
Click to hide internal directories.