Skip to content

spookysploit/kafka-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📡 Kafka Golang Example

A simple Go project that demonstrates basic work with Apache Kafka: the producer sends messages, and the consumer reads them.


Technologies used

  • Language: Go 1.21+
  • Message Broker: Apache Kafka
  • Zookeeper (for Kafka)
  • Containerization: Docker, Docker Compose
  • Lib: github.com/confluentinc/confluent-kafka-go

Launch in Docker

Download repository using command:

git clone https://github.com/spookysploit/kafka-golang.git

Open the repository:

cd ./kafka-golang

Launch command:

docker compose up --build

After the containers are launched, the web interface will also be available at:
http://localhost:9020/


Launching producer and consumer

Download all the dependencies:

go mod tidy

Producer working example (sending messages):

go run ./cmd/producer/main.go

image


Consumer working example (reading messages):

go run ./cmd/consumer/main.go

image

About

golang kafka usage example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages