{"id":19297469,"url":"https://github.com/factorhouse/kpow-streams-spring-cloud-example","last_synced_at":"2026-05-12T12:34:47.392Z","repository":{"id":47483206,"uuid":"401217372","full_name":"factorhouse/kpow-streams-spring-cloud-example","owner":"factorhouse","description":"Monitor Spring Cloud streaming compute with Kpow","archived":false,"fork":false,"pushed_at":"2025-01-22T05:41:26.000Z","size":137,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-16T14:11:44.237Z","etag":null,"topics":["agent","java","kafka","kafka-streams","kpow","monitoring","spring","streams","viz"],"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}},"created_at":"2021-08-30T04:38:27.000Z","updated_at":"2024-12-21T16:16:06.000Z","dependencies_parsed_at":"2024-07-18T07:16:27.870Z","dependency_job_id":"f4149b04-8d07-4fed-8e2c-d5ebf7cac0cc","html_url":"https://github.com/factorhouse/kpow-streams-spring-cloud-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-cloud-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-cloud-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-cloud-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/factorhouse%2Fkpow-streams-spring-cloud-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/factorhouse","download_url":"https://codeload.github.com/factorhouse/kpow-streams-spring-cloud-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400338,"owners_count":19795332,"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":["agent","java","kafka","kafka-streams","kpow","monitoring","spring","streams","viz"],"created_at":"2024-11-09T23:05:01.100Z","updated_at":"2026-05-12T12:34:47.387Z","avatar_url":"https://github.com/factorhouse.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monitor Spring Cloud Applications with Kpow\n\n![streams-topology-usage](https://github.com/user-attachments/assets/c26d9feb-3dcb-45be-b457-5b1d30fa9f9d)\n\n\nIntegrated [Spring Cloud Stream Wordcount](https://github.com/spring-cloud/spring-cloud-stream-samples/tree/main/kafka-streams-samples/kafka-streams-word-count) Kafka Streams example application with the [Kpow Streams Agent](https://github.com/factorhouse/kpow-streams-agent).\n\nRun this project with the original instructions below, we have integrated the Kpow Agent. You will see log-lines like:\n\n```\nKpow: sent [112] streams metrics for application.id hello-word-count-sample\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\n* Follow the original project setup steps (instructions below)\n* Put data on the wordcount topic (instructions below)\n* Start Kpow (see: [Kpow Local](https://github.com/factorhouse/kpow-local) for local evaluation + trial licenses)\n  * If using the single-node Kafka Cluster from this project, set `REPLICATION_FACTOR=1` when running Kpow\n* Navigate to localhost:3000 \u003e Streams\n* View WordCount Topology + Metrics\n* Navigate to Consumers to reset WordCount offsets \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```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.factorhouse\u003c/groupId\u003e\n  \u003cartifactId\u003ekpow-streams-agent\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Integrate the Agent\n\nStart the Kpow Streams Agent (view full source)\n\n```java\npublic static void main(String[] args) {\n        ApplicationContext context = SpringApplication.run(KafkaStreamsWordCountApplication.class, args);\n\n        // The StreamsBuilderFactoryBean name is '\u0026stream-builder-' + your function name from config, .e.g\n        //\n        //   spring.cloud.stream:\n        //      function:\n        //        definition: process \u003c-- '\u0026stream-builder-' + this name here\n        //\n        // We use the SBFB to obtain the streams and topology of your built Spring Kafka Streams application\n        \n        StreamsBuilderFactoryBean streamsBuilderFactoryBean = context.getBean(\"\u0026stream-builder-process\", StreamsBuilderFactoryBean.class);\n        KafkaStreams streams = streamsBuilderFactoryBean.getKafkaStreams();\n        Topology topology = streamsBuilderFactoryBean.getTopology();\n\n        // Create connection properties for the StreamsRegistry producer to send metrics to internal Kpow topics\n        // You should be able to use streamsBuilderFactoryBean.getStreamsConfiguration() but in this particular case\n        // Those properties contain 'bootstrap.servers = [[localhost:9092]]' which errors on startup\n        \n        Properties properties = new Properties();\n        properties.setProperty(\"bootstrap.servers\", \"127.0.0.1:9092\");\n\n        // Create a Kpow StreamsRegistry\n        \n        StreamsRegistry registry = new StreamsRegistry(properties);\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### Original Project Readme Follows\n\n## What is this app?\n\nThis is an example of a Spring Cloud Stream processor using Kafka Streams support.\n\nThe example is based on the word count application from the [reference documentation](https://github.com/apache/kafka/blob/2.8/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountDemo.java).\n\nIt uses a single input and a single output. In essence, the application receives text messages from an input topic and computes word occurrence counts in a configurable time window and report that in an output topic.\nThe sample uses a default timewindow of 30 seconds.\n\n### Running the app:\n\nGo to the root of the repository.\n\n`docker-compose up -d`\n\n`./mvnw clean package`\n\n`java -jar target/kafka-streams-word-count-0.0.1-SNAPSHOT.jar`\n\nAssuming you are running the dockerized Kafka cluster as above.\n\nIssue the following commands:\n\n`docker exec -it kafka-wordcount /opt/kafka/bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic words`\n\nOr if you prefer `kafkacat`:\n\n`kafkacat -b localhost:9092 -t words -P`\n\nOn another terminal:\n\n`docker exec -it kafka-wordcount /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic counts`\n\nOr if you prefer `kafkacat`:\n\n`kafkacat -b localhost:9092 -t counts`\n\nEnter some text in the console producer and watch the output in the console consumer.\n\nOnce you are done, stop the Kafka cluster: `docker-compose down`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-cloud-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-cloud-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactorhouse%2Fkpow-streams-spring-cloud-example/lists"}