kafkapublisher

package
v0.0.0-...-2ba4c8d Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL = 0
	CLOSED = 1
)

Variables

This section is empty.

Functions

func DefaultSaramaConfig

func DefaultSaramaConfig() *sarama.Config

func New

func New(producerOpt ProducerOption, opts ...Option) (easypubsub.Publisher, error)

Types

type MarshalMsgFunc

type MarshalMsgFunc func(topic string, msg *easypubsub.Message) (*sarama.ProducerMessage, error)

type Option

type Option func(o *options)

func WithLogger

func WithLogger(logger easypubsub.Logger) Option

func WithMarshalMsgFunc

func WithMarshalMsgFunc(marshalMsgFunc MarshalMsgFunc) Option

type ProducerOption

type ProducerOption func(o *producerOptions)

func AsyncProducer

func AsyncProducer(brokers []string, config *sarama.Config) ProducerOption

func SyncProducer

func SyncProducer(brokers []string, config *sarama.Config) ProducerOption

type PublishResult

type PublishResult struct {
	Partition int32
	Offset    int64
}

type Publisher

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

func (*Publisher) Close

func (pub *Publisher) Close() error

func (*Publisher) Publish

func (pub *Publisher) Publish(topic string, msg *easypubsub.Message) (result *easypubsub.PublishResult)

func (*Publisher) String

func (pub *Publisher) String() string

Jump to

Keyboard shortcuts

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