{"id":20567424,"url":"https://github.com/sombriks/sample-kafka","last_synced_at":"2026-04-16T10:31:20.608Z","repository":{"id":180289361,"uuid":"664846631","full_name":"sombriks/sample-kafka","owner":"sombriks","description":"sampling how to work with spring-boot and apache kafka","archived":false,"fork":false,"pushed_at":"2023-08-07T19:45:27.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-06T09:23:05.197Z","etag":null,"topics":["docker-compose","java","javalin","kafka","kotlin","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/sombriks.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":"2023-07-10T22:13:43.000Z","updated_at":"2024-12-17T20:14:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ebddd5a-8b1a-46f9-9a94-e4de1b79b03f","html_url":"https://github.com/sombriks/sample-kafka","commit_stats":null,"previous_names":["sombriks/sample-kafka"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sombriks/sample-kafka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-kafka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-kafka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-kafka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-kafka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sombriks","download_url":"https://codeload.github.com/sombriks/sample-kafka/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fsample-kafka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31881970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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-compose","java","javalin","kafka","kotlin","spring-boot"],"created_at":"2024-11-16T04:46:41.313Z","updated_at":"2026-04-16T10:31:20.591Z","avatar_url":"https://github.com/sombriks.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# service-broker-kafka\n\nSmall proof of concept on how to route log messages from one kafkaConsumerApp to a log\nconsumer through a kafka broker\n\n## How kafka works\n\nSee [this](https://medium.com/swlh/apache-kafka-what-is-and-how-it-works-e176ab31fcd5)\n\n## how to run the broker\n\n- install docker, docker-compose\n\n```bash\ncd service-broker-kafka\ndocker compose -f docker-compose-dev.yml up\n```\n\nInstall [intellij kafka plugin](https://plugins.jetbrains.com/plugin/21704-kafka)\nor any other kafka client\n\nConnect on port **9094**\n\n## how to run the service-producer-1\n\n- install java-jdk-17, some IDE (intellij is better)\n\n```bash\ncd service-producer-1\nsh ./gradlew build ; sh ./gradlew bootRun\n```\n\nFirst producer uses default logback logging spring boot subsystem and does not\nwork yet. Messages to kafka streams must be sent in a explicit way\n\n```kotlin\n@Service\nclass SimpleJob(val template: KafkaTemplate\u003cString?, String?\u003e) {\n\n    private val logger by lazy { LoggerFactory.getLogger(SimpleJob::class.java) }\n\n    @Scheduled(fixedRate = 5000)\n    fun work() {\n        val date = \"${Date()}\"\n        logger.info(date)\n        template.send(\"logs\", date)\n    }\n}\n```\n\n## how to run the service-producer-2\n\n- install java-jdk-17, some IDE (intellij is better)\n\n```bash\ncd service-producer-2\nsh ./gradlew build ; sh ./gradlew bootRun\n```\n\nSecond producer uses log4j2 logging spring boot subsystem and logs messages to\na kafka topic in a transparent way. Just log your message and go home.\n\nThere is an issue where it starts to log warnings generated by kafka producer\nitself, and then it enters into an infinite loop. I am working on it.\n\n## how to run the service-consumer-1\n\n- install java-jdk-17, some IDE (intellij is better)\n\n```bash\ncd service-consumer-1\nsh ./mvnw compile ; sh ./mvnw exec:java\n```\n\nThis project aims to use as little boilerplate as possible. it uses \n[javalin](https://javalin.io/), a lightweight java/kotlin web framework and\nkafka-client libraries directly.\n\nKafka consumers subscribes to topics and then starts to poll them in real time,\nsynchronously.\n\nThat means you're not supposed to consume kafka streams in the main thread of a\nweb server, it will hang.\n\nTherefore, this project spawns another thread and then polls kafka messages from\nthere.\n\n## how to run service-consumer-2\n\nThis project uses spring-boot-kafka to consume the streams.\n\n```bash\ncd service-consumer-2\nsh ./mvnw compile ; sh ./mvnw spring-boot:run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fsample-kafka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsombriks%2Fsample-kafka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fsample-kafka/lists"}