{"id":19297450,"url":"https://github.com/factorhouse/kpow-streams-spring-kafka-example","last_synced_at":"2026-02-21T11:30:52.128Z","repository":{"id":46436839,"uuid":"416563707","full_name":"factorhouse/kpow-streams-spring-kafka-example","owner":"factorhouse","description":"Monitor Spring Kafka streaming compute with Kpow","archived":false,"fork":false,"pushed_at":"2025-02-27T00:29:02.000Z","size":133,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-02T04:08:06.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/factorhouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-10-13T02:31:31.000Z","updated_at":"2025-02-27T00:29:03.000Z","dependencies_parsed_at":"2024-07-18T07:17:19.551Z","dependency_job_id":"ddc04324-97db-4e6d-a7fa-6985eb371200","html_url":"https://github.com/factorhouse/kpow-streams-spring-kafka-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/factorhouse/kpow-streams-spring-kafka-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-kafka-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-kafka-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-kafka-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-kafka-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/factorhouse","download_url":"https://codeload.github.com/factorhouse/kpow-streams-spring-kafka-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-kafka-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T11:29:27.227Z","status":"ssl_error","status_checked_at":"2026-02-21T11:29:20.292Z","response_time":107,"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":[],"created_at":"2024-11-09T23:04:57.320Z","updated_at":"2026-02-21T11:30:52.110Z","avatar_url":"https://github.com/factorhouse.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monitor Spring Kafka Applications with Kpow\n\n![streams-topology-usage](https://github.com/user-attachments/assets/57c6549a-a408-4604-af64-068d2ee73d22)\n\n\nIntegrated [Confluent Order Service](https://github.com/confluentinc/streaming-ops/tree/main/apps/microservices-orders/orders-service) Spring Kafka example application with the [Kpow Streams Agent](https://github.com/factorhouse/kpow-streams-agent).\n\nRun this project with the instructions below, we have integrated the Kpow Agent. You will see log-lines like:\n\n```\nKpow: sent [370] streams metrics for application.id OrdersService\n```\n\nOnce started, run Kpow with the target cluster and navigate to 'Streams' to view the live topology and metrics.\n\n### Quickstart\n\n1. Start a 3-Node Kafka Cluster and Kpow with [Kpow Local](https://github.com/factorhouse/kpow-local).\n2. Build the Order Service JAR with `make test`\n3. Run the Order Service JAR with `java -jar build/libs/orders-service-10.0.8.jar`\n4. Navigate to localhost:3000 \u003e Streams \u003e OrdersService (can take 1-2 minutes to appear)\n\n## How We Integrated WordCount Streams with the Kpow Agent\n\n### Get the Kpow Streams Dependency\n\nInclude the Kpow Streams Agent library in your application:\n\n```\nimplementation 'io.factorhouse:kpow-streams-agent:1.0.0'\n```\n\n### Integrate the Agent\n\nWe define a new Component that adds an event-listener to the StreamsBuilderFactoryBean, registering the Streams and Topology once the Kafka Streams application has been started.\n\n```Java\npackage io.confluent.kafkadevops.microservicesorders.ordersservice;\n\nimport io.factorhouse.kpow.StreamsRegistry;\nimport io.factorhouse.kpow.key.ClusterIdKeyStrategy;\nimport org.apache.kafka.streams.KafkaStreams;\nimport org.apache.kafka.streams.Topology;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.kafka.config.StreamsBuilderFactoryBean;\nimport org.springframework.lang.NonNull;\nimport org.springframework.stereotype.Component;\n\n@Component\npublic class KpowAgentService {\n\n  @Autowired\n  public KpowAgentService(final StreamsBuilderFactoryBean factory) {\n\n    factory.addListener(new StreamsBuilderFactoryBean.Listener() {\n      @Override\n      public void streamsAdded(@NonNull String id, @NonNull KafkaStreams streams) {\n        Topology topology = factory.getTopology();\n\n        // Create a Kpow StreamsRegistry connecting to the same Kafka Cluster as Kafka Streams.\n        // Note: In a multi-cluster Kpow setup the StreamsRegistry must be configured with your Primary cluster.\n        StreamsRegistry registry = new StreamsRegistry(factory.getStreamsConfiguration());\n\n        // Specify the key strategy when writing metrics to the internal Kafka topic\n        // props are java.util.Properties describing the Kafka Connection\n        ClusterIdKeyStrategy keyStrat = new ClusterIdKeyStrategy(factory.getStreamsConfiguration());\n        \n        // Register your KafkaStreams and Topology instances with the StreamsRegistry\n        registry.register(streams, topology, keyStrat);\n      }\n    });\n  }\n}\n```\n\n----\n\n### Original Project Readme Follows\n\n## Orders Service\n\nThis is a re-write of the OrdersService found in the Confluent [Microservices Demos examples](https://github.com/confluentinc/kafka-streams-examples/tree/6.0.0-post/src/main/java/io/confluent/examples/streams/microservices)\nusing the Spring Framework.\n\n## Building\n\nThe project contains a `Makefile` for managing build and package.\n\n|            |                                           |\n|------------|-------------------------------------------|\n| `make clean` |will clean build artifacts|\n| `make test`  |will run provide unit and integration tests|\n| `make build` |will build a single shadow jar for running the application|\n| `make package` |will build a Docker image|\n| `make publish` |will build and publish the Docker image to the cnfldemos Confluent Docker Hub repository (proper credentials required)|\n\n## Configuring\n\nThis application builds on the Spring Framework and uses [Spring Application Property Files](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config-application-property-files).\n\nConfiguration can be overridden using [many methods](https://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/boot-features-external-config.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-kafka-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-kafka-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-kafka-example/lists"}