Versions in this module Expand all Collapse all v0 v0.1.0 Oct 26, 2026 Changes in this version + const DefaultAutoCommit + const DefaultBatchBytes + const DefaultBatchSize + const DefaultBatchTimeout + const DefaultConnectionTest + const DefaultMaxBytes + const DefaultMode + const DefaultNackBackoff + const DefaultTopicCreateAttempts + const DefaultTopicCreateBackoff + var ErrWriterClosed = errors.New("kafka writer closed") + func BatchErrors(err error) ([]error, bool) + func FromBrokerMessage(msg any, target any) error + type AcknowledgeableBrokerMessage struct + func NewAcknowledgeableBrokerMessage(message BrokerMessage, acknowledgment messageAcknowledgment) AcknowledgeableBrokerMessage + func (m AcknowledgeableBrokerMessage) Ack() + func (m AcknowledgeableBrokerMessage) Nak() + type BatchPublishResult interface + MessageErrors func() []error + type Broker struct + func NewBroker(config *Config) (*Broker, error) + func (b *Broker) Close(ctx context.Context) + func (b *Broker) Connect(_ context.Context) error + func (b *Broker) Publish(ctx context.Context, topic string, msg any) error + func (b *Broker) PublishAsync(ctx context.Context, topic string, msg any) PublishResult + func (b *Broker) PublishBatch(ctx context.Context, topic string, msgs any) error + func (b *Broker) PublishBatchAsync(ctx context.Context, topic string, msgs any) BatchPublishResult + func (b *Broker) Subscribe(ctx context.Context, topic string, ...) (<-chan struct{}, error) + func (b *Broker) Unsubscribe(ctx context.Context, topic string) error + type BrokerMessage struct + Headers map[string][]byte + Payload []byte + type Config struct + AutoCommit bool + BatchBytes int64 + BatchSize int + BatchTimeout time.Duration + ConnectionTest bool + ControllerFactory ControllerFactory + DSN string + GroupID string + Hosts []string + MaxBytes int + Mode Mode + NackBackoff time.Duration + SaramaFactory SaramaFactory + TopicCreateAttempts int + TopicCreateBackoff time.Duration + func DefaultConfig() Config + type Controller interface + Close func() error + Publish func(ctx context.Context, topic string, msgs []BrokerMessage) ([]error, error) + Subscribe func(ctx context.Context, topic string) (Subscription, error) + type ControllerAdapter struct + func NewControllerAdapter(writer *ControllerWriter, consumerGroupFactory consumerGroupFactory, ...) *ControllerAdapter + func (ca *ControllerAdapter) Close() error + func (ca *ControllerAdapter) Publish(ctx context.Context, topic string, msgs []BrokerMessage) ([]error, error) + func (ca *ControllerAdapter) Subscribe(ctx context.Context, topic string) (Subscription, error) + type ControllerFactory interface + New func(cfg Config) (Controller, error) + type ControllerWriter struct + func (c *ControllerWriter) Close() error + func (c *ControllerWriter) Publish(ctx context.Context, topic string, messages []BrokerMessage) ([]error, error) + type Mode = string + const ModeConsumer + const ModeMixed + const ModeProducer + type PublishError struct + Errs []error + func (e *PublishError) Error() string + func (e *PublishError) Unwrap() []error + type PublishResult interface + Done func() <-chan struct{} + Err func() error + type SaramaFactory interface + NewAsyncProducer func(hosts []string, cfg *sarama.Config) (sarama.AsyncProducer, error) + NewClient func(hosts []string, cfg *sarama.Config) (sarama.Client, error) + NewClusterAdmin func(hosts []string, cfg *sarama.Config) (sarama.ClusterAdmin, error) + NewConsumerGroup func(hosts []string, groupID string, cfg *sarama.Config) (sarama.ConsumerGroup, error) + type Subscription interface + Cancel func(ctx context.Context) + MessagesChannel func() <-chan AcknowledgeableBrokerMessage + type SubscriptionAdapter struct + func (s *SubscriptionAdapter) Cancel(ctx context.Context) + func (s *SubscriptionAdapter) MessagesChannel() <-chan AcknowledgeableBrokerMessage