kafka

package
v0.0.0-...-4e705d1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	Listen(topic string, received chan []byte)
}

Consumer defines the consumer operations

type Messager

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

Messager implements kafka message functionality

func NewMessager

func NewMessager() *Messager

NewMessager will instantiate an instance using the producer provided

func (*Messager) Listen

func (m *Messager) Listen(topic string, received chan []byte, signals chan bool)

Listen will listen indefinitely to the kafka bus for messages on a specific topic

func (*Messager) Relay

func (m *Messager) Relay(inTopic, outTopic string, stop chan os.Signal) error

Relay will start listening for messages, transforming, and sending onwards

func (*Messager) SendMessage

func (m *Messager) SendMessage(topic, mKey string, mValue []byte) error

SendMessage can send a message to the

func (*Messager) WithConsumer

func (m *Messager) WithConsumer(c sarama.Consumer) *Messager

WithConsumer will set the consumer instance on the messager

func (*Messager) WithProducer

func (m *Messager) WithProducer(p sarama.SyncProducer) *Messager

WithProducer will set the producer instance on the messager

func (*Messager) WithRelayTransform

func (m *Messager) WithRelayTransform(rt RelayTransform) *Messager

WithRelayTransform will set the relay transform func instance on the messager

type Producer

type Producer interface {
	SendMessage(topic, msg string, value []byte) error
}

Producer defines the producer operations

type RelayTransform

type RelayTransform func(msg []byte) ([]byte, error)

RelayTransform aliases the function for transforming relayed messages

Jump to

Keyboard shortcuts

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