Skip to content

The simple Kafka client in GoLang! Read and transform messages with ease.

License

Notifications You must be signed in to change notification settings

FoxComm/metamorphosis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metamorphosis

metamorphosis is a Go client for easily interacting with Kafka. It works best when used to handle a Kafka setup that's clustered with Zookeeper and whose messages are encoded with Avro.

Usage

import "github.com/FoxComm/metamorphosis"

Construct a new consumer by creating a Consumer that connects to Zookeeper and the Avro schema registry and provide offset reset strategy value ("largest" or "smallest").

For example:

zookeeper := "localhost:2181"
schemaRepo := "http://localhost:8081"
resetOffsetStrategy := "smallest" // or "largest"

consumer, err := metamorphosis.NewConsumer(zookeeper, schemaRepo, resetOffsetStrategy)

To handle messages, define a handler and run against a topic:

handler := func(message AvroMessage) error {
  bytes := message.Bytes()
  fmt.Println(string(bytes))
  return nil
}

consumer.RunTopic("my_topic", handler)

License

MIT

About

The simple Kafka client in GoLang! Read and transform messages with ease.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages