{"id":15192108,"url":"https://github.com/davidarchanjo/spring-boot-kafka","last_synced_at":"2026-02-01T23:02:34.909Z","repository":{"id":119392162,"uuid":"383729665","full_name":"davidarchanjo/spring-boot-kafka","owner":"davidarchanjo","description":"Sample Spring Boot project for demostrating communication between microservices through events via Kafka.","archived":false,"fork":false,"pushed_at":"2021-08-22T23:11:03.000Z","size":892,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T14:43:04.022Z","etag":null,"topics":["docker","dockercompose","java","kafka","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","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/davidarchanjo.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":"2021-07-07T08:35:52.000Z","updated_at":"2025-04-22T07:06:56.000Z","dependencies_parsed_at":"2023-12-28T07:15:14.278Z","dependency_job_id":null,"html_url":"https://github.com/davidarchanjo/spring-boot-kafka","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"5f98fa5e9dc0ef2f67fcc2f10557559a321d85ba"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidarchanjo/spring-boot-kafka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidarchanjo","download_url":"https://codeload.github.com/davidarchanjo/spring-boot-kafka/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-kafka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28993751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T22:01:47.507Z","status":"ssl_error","status_checked_at":"2026-02-01T21:58:37.335Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["docker","dockercompose","java","kafka","spring-boot"],"created_at":"2024-09-27T21:05:05.480Z","updated_at":"2026-02-01T23:02:34.896Z","avatar_url":"https://github.com/davidarchanjo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Compose + Kafka + Spring Boot\n![banner](./assets/banner.jpg)\n\n## Overview\nThis project aims to be a reference for those just starting to work with Java and SpringBoot in which there is a need to build an inner communication between microservices through events via Kafka. To speed up the setup of the development environment, a dockercompose is provided to provision the necessary infrastructure, i.e. Kafka and Zookeeper. **Be aware of the proposed infrastructure is suitable for development and not for production operation.**\n## Prerequisites\n\n- Maven 3+\n- Java 8+\n- Docker 19.03+ \n\n\n## Preparing Environment\n\nFrom the project's folder, execute:\n- `docker-compose up` to initialize Kafka and Zookeeper\n- `mvn package` to build the applications\n\n\n## Booting Applications\n\n- Initializing the `producer`\n````bash\n$ cd producer\n$ mvn spring-boot:run\n````\n**Note:** The `producer` will be accepting request at `http://localhost:8080/orders`\n\n\n- Initializing the `consumer`\n````bash\n$ cd consumer\n$ mvn spring-boot:run\n````\n**Note:** The `consumer` has no endpoint, it just connects to the Kafka to listen to the stream events.\n\n\n## Testing \n\nWith both `consumer` and `producer` applications up and running, let's test their integration through Kafka:\n````bash\n$ curl -d \"{'idorder': '1234', 'customer': 'Foo Bar', 'value': 4321}\" \\\n-H \"Content-Type: application/json\" \\\n-X POST http://127.0.0.1:8080/orders\n````\n\nIf the above request works, we should see a log in the `producer` application's console that looks like the following:\n````\n2021-07-07 06:23:26.433  INFO 2336 --- [ad | producer-1] b.c.d.producer.config.KafkaConfig        : ACK from ProducerListener message: {\"idorder\": \"12345\", \"customer\": \"Foo Bar\", \"value\": 54321} offset:  0\n````\nand something like in the `consumer` application's console:\n````\n2021-07-07 06:23:26.490  INFO 3996 --- [ntainer#0-0-C-1] b.c.d.consumer.kafka.KafkaConsumer       : Order: {\"idorder\": \"12345\", \"customer\": \"Foo Bar\", \"value\": 54321}\n````\n\n\n## Cleaning Up\nAfter playing around, we need to clean up the mess.. So from the project's folder, do:\n\u003col\u003e\n\u003cli\u003eStop the containers using the following command:\u003c/li\u003e\n  \u003ccode\u003edocker-compose down\u003c/code\u003e\n\u003cli\u003eDelete all containers using the following command:\u003c/li\u003e\n  \u003ccode\u003edocker rm -f $(docker ps -a -q)\u003c/code\u003e\n\u003c/ol\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidarchanjo%2Fspring-boot-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidarchanjo%2Fspring-boot-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidarchanjo%2Fspring-boot-kafka/lists"}