publisher

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

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

Message is an abstraction based around kafka.Message

func (*Message) GetKey

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

GetKey returns the key of the message

func (*Message) GetValue

func (m *Message) GetValue() interface{}

GetValue returns the value of the message

type MessageInterface

type MessageInterface interface {
	GetKey() []byte
	GetValue() interface{}
}

MessageInterface is an abstraction on top of kafka.Message

func NewMessage

func NewMessage(key string, value interface{}) MessageInterface

NewMessage creates a new object implementing MessageInterface

type Producer

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

Producer is the implementation of a kafka publisher it will autorefresh tls secrets automatically can be configured with multiple writers, each of those will need a nickname and will be known by that when calling the Publish method

func NewProducer

func NewProducer(monitor monitoring.MonitorInterface, refreshables ...core.RefreshableInterface) *Producer

NewProducer creates a new object implementing ProducerInterface

func (*Producer) Close

func (p *Producer) Close()

Close flushes all the kafka.Writers

func (*Producer) ListTopics

func (p *Producer) ListTopics() map[string]string

ListTopics returns a list of topics with their nicknames

func (*Producer) Publish

func (p *Producer) Publish(topicNickname string, messages ...MessageInterface) error

Publihs is the main method of the class, used to write messages on kafka

func (*Producer) Stats

func (p *Producer) Stats(topicNickname string) kafka.WriterStats

Stats returns kafka.WriterStats

Jump to

Keyboard shortcuts

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