Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimmyjr/goku
Golang and Kafka Unificated
https://github.com/dimmyjr/goku
confluent goku golang grafana hacktoberfest kafka oktoberfest prometheus prometheus-exporter
Last synced: 2 months ago
JSON representation
Golang and Kafka Unificated
- Host: GitHub
- URL: https://github.com/dimmyjr/goku
- Owner: dimmyjr
- License: mit
- Created: 2020-07-07T04:17:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-26T03:56:27.000Z (about 4 years ago)
- Last Synced: 2024-09-30T08:03:41.950Z (3 months ago)
- Topics: confluent, goku, golang, grafana, hacktoberfest, kafka, oktoberfest, prometheus, prometheus-exporter
- Language: Go
- Homepage: https://dimmyjr.github.io/goku/
- Size: 396 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![PkgGoDev](https://pkg.go.dev/badge/github.com/dimmyjr/goku)](https://pkg.go.dev/github.com/dimmyjr/goku)
[![Go Report Card](https://goreportcard.com/badge/github.com/dimmyjr/goku)](https://goreportcard.com/report/github.com/dimmyjr/goku)![logo](https://user-images.githubusercontent.com/3587262/93725006-1ed7c980-fb82-11ea-9bcc-cfb33cd4bbbf.jpg)
Integrate golang with kafka in a simple and fast way, being able to choose the provider you want.
# Features
- Producer
- Consumer
- gRPC Server
- Metrics on Prometheus and Grafana# Providers
- https://github.com/segmentio/kafka-go
- https://github.com/Shopify/sarama
- https://github.com/confluentinc/confluent-kafka-go# Usage
### Publisher (Producer)
```
package publisher_testimport (
"github.com/dimmyjr/goku/publisher"
"github.com/dimmyjr/goku/types"
"log"
)func Example_minimal() {
kafkaURL := "localhost:9092"
topic := "topic-segmentio"
key := "topicKey"
message := " ...kafka message... "producer, err := publisher.New([]string{kafkaURL}, topic, types.Segmentio)
if err != nil {
log.Fatal("error to initialize producer")
}err = producer.Publish(key, message)
if err != nil {
log.Fatal("error to send message")
}
}
```### Subscriber (Consumer)
```
package subscriber_testimport (
"fmt"
"github.com/dimmyjr/goku/subscriber"
"github.com/dimmyjr/goku/types"
"log"
)func Example_minimal() {
kafkaURL := "localhost:9092"
topic := "topic-segmentio"
groupID := "tests"consumer, err := subscriber.NewConsumer([]string{kafkaURL}, topic, groupID, types.Segmentio)
if err != nil {
log.Fatal("error to initialize producer")
}consumer.Subscribe(read)
}
func read(input subscriber.Message) error {
fmt.Print(input.Value)
return nil
}```
# Contributing
Interested in contributing to GoKu? We'd love your help. GoKu is an open source project, built one contribution at a time by users like you. See the CONTRIBUTING file for instructions on how to contribute.# References
- https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/
- https://github.com/edenhill/librdkafka