kafka

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSASLPublisherConfig added in v0.0.4

func NewSASLPublisherConfig(username, password string) *sarama.Config

NewSASLPublisherConfig creates a new kafka publisher config with SASL authentication.

func NewSASLSubscriberConfig added in v0.0.4

func NewSASLSubscriberConfig(username, password string) *sarama.Config

NewSASLSubscriberConfig creates a new kafka subscriber config with SASL authentication.

Types

type Publisher

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

Publisher represents a kafka publisher.

func NewPublisher

func NewPublisher(
	logger *zap.Logger,
	saramaConfig *sarama.Config,
	brokers []string,
) (*Publisher, error)

NewPublisher creates a new kafka publisher.

func (Publisher) Close

func (p Publisher) Close() error

Close closes the kafka publisher.

func (Publisher) Publish

func (p Publisher) Publish(event pubsub.Event[[]byte], channels ...string) error

Publish publishes an event to a kafka topic.

type Subscriber

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

Subscriber represents a kafka subscriber.

func NewSubscriber

func NewSubscriber(
	logger *zap.Logger,
	saramaConfig *sarama.Config,
	brokers []string,
	consumerGroup string,
) (*Subscriber, error)

NewSubscriber creates a new kafka subscriber.

func (Subscriber) Close

func (s Subscriber) Close() error

Close closes the kafka subscriber.

func (Subscriber) Subscribe

func (s Subscriber) Subscribe(channels ...string) (pubsub.Subscription[[]byte], error)

Subscribe subscribes to a kafka topic.

type Subscription

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

Subscription represents a stream of events published to a kafka topic.

func (Subscription) C

func (s Subscription) C() <-chan pubsub.Event[[]byte]

C returns a receive-only go channel of events published.

func (Subscription) Close

func (s Subscription) Close() error

Close closes the subscription.

Jump to

Keyboard shortcuts

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