kafka

package
v0.0.0-...-c1eb743 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDialer

func NewDialer() *kafka.Dialer

func NewSecureDialer

func NewSecureDialer(awsRegion string) (*kafka.Dialer, error)

Types

type ErrorList

type ErrorList []error

func (ErrorList) Error

func (el ErrorList) Error() string

type HandlerFunc

type HandlerFunc func(e *Message)

type Message

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

func NewMessage

func NewMessage(km kafka.Message) *Message

func (*Message) Ack

func (m *Message) Ack() error

func (*Message) Data

func (m *Message) Data() []byte

func (*Message) Key

func (m *Message) Key() []byte

func (*Message) Nack

func (m *Message) Nack() error

type Option

type Option func(p *Provider)

func WithBatchSize

func WithBatchSize(size uint) Option

func WithBatchTimeout

func WithBatchTimeout(timeout time.Duration) Option

func WithDialer

func WithDialer(dialer *kafka.Dialer) Option

WithDialer configures the pubsub.Service to use the provided dialer

func WithLog

func WithLog(log logrus.FieldLogger) Option

type Provider

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

Provider implements pubsub.Provider

func NewProvider

func NewProvider(brokers []string, serviceName string, awsRegion string, opts ...Option) (*Provider, error)

NewProvider creates a new kafka.Provider

func (*Provider) Publish

func (p *Provider) Publish(ctx context.Context, topic string, data []byte, key []byte) error

Publish implements pubsub.Publisher

func (*Provider) Stop

func (p *Provider) Stop() error

Stop implements pubsub.Subscriber

func (*Provider) Subscribe

func (p *Provider) Subscribe(topic string, h pubsub.ProviderHandlerFunc)

Subscribe implements pubsub.Subscriber

type Subscription

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

func NewSubscription

func NewSubscription(topic string, reader *kafka.Reader, log logrus.FieldLogger) *Subscription

NewSubscription creates a new Subscription for the specified topic

func (*Subscription) Add

func (s *Subscription) Add(handler HandlerFunc)

Add a handler for this topic

func (*Subscription) Start

func (s *Subscription) Start()

Start listening for new messages

func (*Subscription) Stop

func (s *Subscription) Stop()

Stop this subscriber from listening for more messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳