package main
import (
easyKafka "github.com/diazoxide/easy-kafka"
"log"
"os"
)
type MyMessageType struct {
From string `json:"from"`
Content string `json:"content"`
}
func main() {
logger := log.New(os.Stdout, "test", log.Ltime)
k := easyKafka.New[MyMessageType](
[]string{"kafka:9092"}, // KafkaUris,
"my-prefix", // Topics Prefix
"my-group", // Consumer Group
12, // Partitions
logger, // Logger
)
k.Produce( "my-topic", &MyMessageType{"test","test"} )
k.Consume([]string{"my-topic"}, func(message MyMessageType) error{
// Your code here
return nil
}, true)
// ...
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Light Apache Kafka Client For Consumer/Producer Stack
License
diazoxide/easy-kafka
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Light Apache Kafka Client For Consumer/Producer Stack
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published