kafkasarama

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSASLPlainPublisherConfig added in v0.0.18

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

NewSASLPlainPublisherConfig creates a new kafka publisher config with Plain SASL authentication.

func NewSASLPlainSubscriberConfig added in v0.0.18

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

NewSASLPlainSubscriberConfig creates a new kafka subscriber config with Plain SASL authentication.

func NewSASLPublisherConfig

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

NewSASLPublisherConfig creates a new kafka publisher config with SASL authentication.

func NewSASLSubscriberConfig

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(
	slogHandler slog.Handler,
	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[string, []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(
	slogHandler slog.Handler,
	saramaConfig *sarama.Config,
	brokers []string,
	consumerGroup string,
) (*Subscriber, error)

NewSubscriber creates a new kafka subscriber. nolint: revive // allow unused consumerGroup parameter for future proofing.

func (Subscriber) Subscribe

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

Subscribe creates a new subscription that runs in the background.

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[string, []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