kafka

package
v0.0.0-...-b820d62 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	URL            string `conf:"default=localhost"`
	Port           string `conf:"default=9093"`
	Events         string `conf:"default=events"`
	Items          string `conf:"default=items"`
	KeepAlive      int    `conf:"range=60:300,default=300"`
	Username       string `conf:"optional"`
	Password       string `conf:"optional"`
	CaFile         string `conf:"optional"`
	ClientCertFile string `conf:"optional"`
	ClientKeyFile  string `conf:"optional"`
	Retry          int    `conf:"default=0"`
	Timeout        int    `conf:"default=1"`
	TLSAuth        bool   `conf:"default=false"`
	EnableTLS      bool   `conf:"optional"`
}

Configuration hold kafka configuration tags bases on Zabbix configuration package from plugin support.

type DefaultProducer

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

DefaultProducer produces data to Kafka broker.

func NewProducer

func NewProducer(c *Configuration) (*DefaultProducer, error)

NewProducer creates Kafka producers from with provided configuration.

func (*DefaultProducer) Close

func (p *DefaultProducer) Close() error

Close closes the underlying async producer.

func (*DefaultProducer) ProduceEvent

func (p *DefaultProducer) ProduceEvent(key, message string)

ProduceEvent produces Kafka message to the event topic in the broker provided in the async producer.

func (*DefaultProducer) ProduceItem

func (p *DefaultProducer) ProduceItem(key, message string)

ProduceItem produces Kafka message to the item topic in the broker provided in the async producer.

type Producer

type Producer interface {
	ProduceItem(key, message string)
	ProduceEvent(key, message string)
	Close() error
}

Producer defines requirements for Kafka producer.

Jump to

Keyboard shortcuts

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