{"id":23200761,"url":"https://github.com/muharik19/go-kafka","last_synced_at":"2026-05-09T00:05:36.506Z","repository":{"id":228742449,"uuid":"774773099","full_name":"muharik19/go-kafka","owner":"muharik19","description":"Learning Kafka and Connection Kafka To Golang Application","archived":false,"fork":false,"pushed_at":"2024-03-20T09:02:28.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T20:43:41.361Z","etag":null,"topics":["docker","docker-compose","golang","kafka","kafka-cli","makefile","message-broker","message-queue"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muharik19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-20T06:44:59.000Z","updated_at":"2024-04-23T06:37:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8171e3d-c8a5-43df-8c58-c96589d998b6","html_url":"https://github.com/muharik19/go-kafka","commit_stats":null,"previous_names":["muharik19/go-kafka"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muharik19%2Fgo-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muharik19%2Fgo-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muharik19%2Fgo-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muharik19%2Fgo-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muharik19","download_url":"https://codeload.github.com/muharik19/go-kafka/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247314227,"owners_count":20918797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","golang","kafka","kafka-cli","makefile","message-broker","message-queue"],"created_at":"2024-12-18T15:12:35.401Z","updated_at":"2026-05-09T00:05:36.466Z","avatar_url":"https://github.com/muharik19.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Kafka and Connection Kafka To Golang Application\n\n## Contents\n\n- [Learning Kafka and Connection Kafka To Golang Application](#learning-kafka-and-connection-kafka-to-golang-application)\n  - [Contents](#contents)\n  - [Installation](#installation)\n  - [Quick Start](#quick-start)\n  - [Kafka CLI](#kafka-cli)\n\n## Installation\n\nTo install Kafka package, you need to install Go and set your Go workspace first.\n\n1.  You first need [Go](https://golang.org/) installed (**version 1.18+ is required**), then you can use the below Go command to install Kafka.\n\n```sh\n$ go get -u github.com/confluentinc/confluent-kafka-go/kafka\n```\n\n2. Import it in your code:\n\n```go\nimport \"github.com/confluentinc/confluent-kafka-go/kafka\"\n```\n\n3. You first need Makefile\n\n```sh\n# install windows\nC:\\\u003e choco install make\n```\n\n```sh\n# install linux\n$ sudo apt-get install make\n```\n\n```sh\n# install MacOS with Homebrew\n$ brew install make\n```\n\n#### Verify Version Makefile\n\n```sh\n# verify that Makefile is installed correctly by checking the version\n$ make --version\n```\n\n4. You first need [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed.\n\n5. You first need Docker Compose.\n\n#### Windows and macOS\n\n- **Docker Compose is included in Docker Desktop for Windows and macOS.**\n\n#### Linux\n\n- **For Ubuntu and Debian, run:**\n\n```sh\n$ sudo apt-get update\n$ sudo apt-get install docker-compose-plugin\n```\n\n- **For RPM-based distros, run:**\n\n```sh\n$ sudo yum update\n$ sudo yum install docker-compose-plugin\n```\n\n#### Verify Version Docker Compose\n\n```sh\n# verify that Docker Compose is installed correctly by checking the version\n$ docker compose version\n```\n\n6. You first need Kafka CLI or Web UI\n\n```sh\n# install kafka cli, make sure all container running\n$ make compose\n```\n\n```sh\n# install kafka web ui, make sure all container running, wait 1 minutes, then open to browser http://localhost:9021\n$ make compose-ui\n```\n\n## Quick Start\n\n- Producer\n\n```sh\n# application producer, run:\n$ make producer\n```\n\n- Consumer\n\n```sh\n# application consumer1, run:\n$ make consumer1\n```\n\n```sh\n# application consumer2, run:\n$ make consumer2\n```\n\n## Kafka CLI\n\n**Note that you need to set the corresponding binding tag on Operating System. For example: `winpty`, `sudo` or etc**\n\n```sh\n# entry into docker container kafka, run:\n$ make exec\n```\n\n#### Create Topic\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --create --topic YOURTOPIC\n```\n\n#### Create Topic with specific configuration\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --create --topic YOURTOPIC --replication-factor 1 --partitions 3 --config \"cleanup.policy=compact\" --config \"delete.retention.ms=100\"  --config \"segment.bytes=204800\" --config \"min.cleanable.dirty.ratio=0.01\"\n```\n\n#### List Topic\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --list\n```\n\n#### Delete Topic\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --delete --topic YOURTOPIC\n```\n\n#### Alter Topic\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --alter --topic YOURTOPIC --partitions 3\n```\n\n#### List Detail Topic\n\n```sh\n$ kafka-topics --bootstrap-server localhost:9092 --describe --topic YOURTOPIC\n```\n\n#### Send Message Producer\n\n```sh\n$ kafka-console-producer --bootstrap-server localhost:9092 --topic YOURTOPIC\n```\n\n#### Send Message Producer with Key\n\n```sh\n# example: \u003e1:test\n$ kafka-console-producer --bootstrap-server localhost:9092 --topic YOURTOPIC --property \"parse.key=true\" --property \"key.separator=:\"\n```\n\n#### Received Message Consumer\n\n```sh\n$ kafka-console-consumer --bootstrap-server localhost:9092 --topic YOURTOPIC --from-beginning\n```\n\n#### Received Message Consumer Group\n\n```sh\n$ kafka-console-consumer --bootstrap-server localhost:9092 --topic YOURTOPIC --group YOURGROUP --from-beginning\n```\n\n#### Received Message Consumer Group with Key\n\n```sh\n$ kafka-console-consumer --bootstrap-server localhost:9092 --topic YOURTOPIC --group YOURGROUP --from-beginning --property \"print.key=true\"\n```\n\n#### List Consumer Group Offset\n\n```sh\n$ kafka-consumer-groups --bootstrap-server localhost:9092 --all-groups --all-topics --describe\n```\n\n#### List Consumer Group Offset 1\n\n```sh\n$ kafka-consumer-groups --bootstrap-server localhost:9092 --group YOURGROUP --describe\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuharik19%2Fgo-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuharik19%2Fgo-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuharik19%2Fgo-kafka/lists"}