kafka

package
v0.0.0-...-e90a610 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 3 Imported by: 0

README

kafka

kafka producer and consumer implementations based on https://github.com/Shopify/sarama

Usage

go kafka.StartConsumer("localhost:9092", "myTopic", 0, -2, 1)
for {
    select {
    case msg := <-kafka.MsgChan:
        fmt.Println(msg)
    case err := <-kafka.ErrChan:
        logrus.Error(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MsgChan for receiving kafka messages
	MsgChan chan *sarama.ConsumerMessage
	// ErrChan for receiving kafka errors
	ErrChan chan *sarama.ConsumerError
)

Functions

func Produce

func Produce(host, topic string, key string, value []byte, partition int32)

Produce Produce

func StartConsumer

func StartConsumer(host, topic string, partition int32, offset int64, interval int)

StartConsumer StartConsumer

Types

This section is empty.

Jump to

Keyboard shortcuts

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