kafka

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOPIC_ID_HEADER_KEY   = "kafka_topic_id"
	EVENT_TYPE_HEADER_KEY = "kafka_event_type"
	DEFAULT_TOPIC_ID      = "gameserver.events"
)

Variables

This section is empty.

Functions

func CheckEmpty

func CheckEmpty(source, newValue string) string

CheckEmpty is a helper function that will check if source is empty and assign newValue if so

func GetTopicIDFromHeader

func GetTopicIDFromHeader(envelope *events.Envelope) (string, bool)

Types

type Config

type Config struct {
	GenericTopicID   string
	OnAddTopicID     string
	OnUpdateTopicID  string
	OnDeleteTopicID  string
	APIKey           string
	APISecret        string
	BootstrapServers string
}

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults sets default values for the Config used by the KafkaBroker

type KafkaBroker

type KafkaBroker struct {
	*Config
	*kafka.Producer
	*kafka.AdminClient
}

func NewKafkaBroker

func NewKafkaBroker(config *Config) (*KafkaBroker, error)

func (*KafkaBroker) BuildEnvelope

func (k *KafkaBroker) BuildEnvelope(event events.Event) (*events.Envelope, error)

func (*KafkaBroker) SendMessage

func (k *KafkaBroker) SendMessage(envelope *events.Envelope) error

func (*KafkaBroker) SetEnvelopeHeader

func (k *KafkaBroker) SetEnvelopeHeader(event events.Event, envelope *events.Envelope)

Jump to

Keyboard shortcuts

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