kafka

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvNameKafkaBrokers       string = "BLUDGEON_KAFKA_BROKERS"
	EnvNameKafkaClientId      string = "BLUDGEON_KAFKA_CLIENT_ID"
	EnvNameKafkaGroupId       string = "BLUDGEON_KAFKA_GROUP_ID"
	EnvNameKafkaConsumerGroup string = "BLUDGEON_KAFKA_CONSUMER_GROUP"
	EnvNameKafkaEnableLog     string = "BLUDGEON_KAFKA_ENABLE_LOG"
)
View Source
const (
	NoBrokersConfigured  string = "no brokers configured"
	NoClientIdConfigured string = "no client id configured"
	NoGroupIdConfigured  string = "no group id configured"
)
View Source
const (
	ConfigNil string = "config is nil"
)

Variables

View Source
var (
	ErrNoBrokersConfigured  = errors.New(NoBrokersConfigured)
	ErrNoClientIdConfigured = errors.New(NoClientIdConfigured)
	ErrNoGroupIdConfigured  = errors.New(NoGroupIdConfigured)
)
View Source
var ErrConfigNil = errors.New(ConfigNil)

Functions

Types

type Client

type Client interface {
	Publish(topic string, item interface{}) (err error)
	Subscribe(topic string, handler HandleFx) (handlerId string, err error)
	Unsubscribe(topic string, handlerIds ...string)
	Topics(regEx *regexp.Regexp) ([]string, error)
}

type Configuration

type Configuration struct {
	Brokers       []string `json:"brokers"`
	ClientId      string   `json:"client_id"`
	GroupId       string   `json:"group_id"`
	EnableLog     bool     `json:"enable_log"`
	ConsumerGroup bool     `json:"consumer_group"`
}

func (*Configuration) Default

func (c *Configuration) Default()

func (*Configuration) FromEnv

func (c *Configuration) FromEnv(envs map[string]string)

func (*Configuration) ToSarama

func (c *Configuration) ToSarama() ([]string, *sarama.Config)

func (*Configuration) Validate

func (c *Configuration) Validate() error

type HandleFx

type HandleFx func(topic string, bytes []byte)

Jump to

Keyboard shortcuts

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