Giter Site home page Giter Site logo

dimmyjr / goku Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 1.0 406 KB

Golang and Kafka Unificated

Home Page: https://dimmyjr.github.io/goku/

License: MIT License

Makefile 6.30% Go 93.70%
hacktoberfest oktoberfest kafka golang goku prometheus-exporter prometheus grafana confluent

goku's Introduction

PkgGoDev Go Report Card

logo

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

Usage

Publisher (Producer)

package publisher_test

import (
	"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_test

import (
	"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

goku's People

Contributors

dimmyjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wesmota

goku's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.