kafka

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package kafka publishes outbox events to Apache Kafka using IBM/sarama.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSaramaConfig added in v0.1.0

func NewSaramaConfig() *sarama.Config

NewSaramaConfig returns a durable producer config: acks=all, idempotent, ordered retries and hash partitioning by Event.Key.

Types

type Config

type Config struct {
	Brokers []string
	// DefaultTopic is used when Event.Topic is empty.
	DefaultTopic string
	// Sarama overrides the producer config. Nil uses NewSaramaConfig().
	// Producer.Return.Successes is always forced to true.
	Sarama *sarama.Config
}

Config configures the publisher.

type Publisher

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

Publisher implements xoutbox.BatchPublisher.

func New added in v0.1.0

func New(cfg Config) (*Publisher, error)

New creates a publisher with its own producer. Call Close when done.

func NewFromProducer added in v0.1.0

func NewFromProducer(p sarama.SyncProducer, defaultTopic string) *Publisher

NewFromProducer wraps an existing SyncProducer.

func (*Publisher) Close

func (p *Publisher) Close() error

Close closes the underlying producer.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, e xoutbox.Event) error

func (*Publisher) PublishBatch added in v0.1.0

func (p *Publisher) PublishBatch(ctx context.Context, events []xoutbox.Event) []error

Jump to

Keyboard shortcuts

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