kafka

package module
v0.0.0-...-25a4ab2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: MIT Imports: 6 Imported by: 0

README

kafka-client

NAME:
   Apache Kafka Client CLI - CLI application for interacting with Apache Kafka

USAGE:
   main [global options] command [command options] [arguments...]

VERSION:
   0.0.0

COMMANDS:
     consume  consumes a message on given topic, partition and offset
     produce  publishes given message on given topic
     brokers  saves broker urls to storage
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --brokers value  Saves broker urls
   --help, -h       show help
   --version, -v    print the version
Install
$ git clone https://github.com/minhajuddinkhan/kafka-client
$ cd kafka-client
Set brokers
$ go run bin/kafka-client/main.go brokers set localhost:9092
Consume messages from Kafka
$ go run bin/kafka-client/main.go consume --topic topic-name --brokers localhost:9092 --partition 0
Publish topics to kafka
go run bin/kafka-client/main.go produce --topic 123 --value {"msg: "Hello Kafka"} --brokers localhost:9092,ec2:9092

Run Kafka Locally with zoo-keeper out of the box

$ sudo docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Gets the list of brokers
	Brokers() []string

	// Publishes a message on the given topic
	// Returns partition, offset and error occurred if any
	Produce(topic string, value interface{}) (partition int32, offset int64, err error)

	// Consumes a message on the given topic and partition
	// Returns error occurred if any
	Consume(topic string, partition int32, msgCh chan interface{}) (error error)

	SetTLSConfig(certFilepath, keyFilepath string) error
}

Client the kafka client

func NewClient

func NewClient(brokerUrls []string) Client

NewClient creates a new client

Directories

Path Synopsis
bin
kafka-client command

Jump to

Keyboard shortcuts

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