{"id":18822994,"url":"https://github.com/morzhanov/kafka-examples","last_synced_at":"2025-09-06T14:52:14.573Z","repository":{"id":122681336,"uuid":"286275690","full_name":"morzhanov/kafka-examples","owner":"morzhanov","description":"Apache Kafka examples","archived":false,"fork":false,"pushed_at":"2020-08-11T10:34:47.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-06T23:05:14.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/morzhanov.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":"2020-08-09T16:36:14.000Z","updated_at":"2020-08-11T10:34:49.000Z","dependencies_parsed_at":"2024-06-19T10:15:49.347Z","dependency_job_id":"2740ece5-3646-45b0-8ae0-7b62581475d3","html_url":"https://github.com/morzhanov/kafka-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morzhanov/kafka-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fkafka-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fkafka-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fkafka-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fkafka-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morzhanov","download_url":"https://codeload.github.com/morzhanov/kafka-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morzhanov%2Fkafka-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273919931,"owners_count":25191207,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-08T00:52:19.447Z","updated_at":"2025-09-06T14:52:14.509Z","avatar_url":"https://github.com/morzhanov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kafka-examples\n\nApache Kafka examples\n\n## environment\n\nYou should create .env file with IP address to run kafka\n\nexample .env\n\n```bash\nIP_ADDR=192.168.0.180\n```\n\nYou can get your ip address using command:\n\n```bash\nifconfig | grep \"inet \" | grep -v 127.0.0.1 | cut -d\\ -f2\n```\n\n## setup\n\nTo setup cluster run:\n\n```bash\ndocker-compose up -d\n```\n\nThis command will create 3 Zookeeper instances and 3 Kafka instances.\n\n## management\n\nTo create `example` topic run:\n\n```bash\ndocker exec -t \u003cKafkaContainerID\u003e \\\n    kafka-topics --create \\\n    --topic example \\\n    --partitions 4 \\\n    --replication-factor 2 \\\n    --if-not-exists \\\n    --zookeeper 192.168.0.180:32181\n```\n\nTo list topics run:\n\n```bash\ndocker exec -t \u003cKafkaContainerID\u003e kafka-topics --list --zookeeper 192.168.0.180:32181\n```\n\nYou can use kafkacat tool to use kafka CLI:\n\n```bash\nbrew install kafkacat  #macos\n\napt install kafkacat   #apt\n```\n\nTo listen to partiotions run:\n\n```bash\nkafkacat -C -b localhost:19092,localhost:29092,localhost:39092 -t example -p 0\n```\n\nTo list consumer groups:\n\n```bash\nkafka-consumer-groups --list --bootstrap-server 192.168.0.180:19092\n```\n\n## app\n\n- Application uses golang gin for HTTP server creation and routing\n- default port: `8080`\n- default topic: `example`\n- default partition: `0`\n- endpoints\n\n  - `GET /messages` - get all messages for default consumer group `example-consumer-group`\n  - `GET /messages/:partition/:offset` - get message on desired partition and offset\n  - `POST /messages` - create message\n\n    - body:\n\n    ```json\n    {\n      \"Key\": \"key\",\n      \"Value\": \"value\"\n    }\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorzhanov%2Fkafka-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorzhanov%2Fkafka-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorzhanov%2Fkafka-examples/lists"}