{"id":20695137,"url":"https://github.com/ibm-cloud-architecture/refarch-eda-item-inventory","last_synced_at":"2025-07-02T11:33:11.665Z","repository":{"id":76530567,"uuid":"294544272","full_name":"ibm-cloud-architecture/refarch-eda-item-inventory","owner":"ibm-cloud-architecture","description":"This project illustrates combining Kafka streams with reactive programming, reactive messaging with Quarkus. The use case is around getting item sold events and build a real time inventory in kafka streams exposed via REST on top of sequential queries. ","archived":false,"fork":false,"pushed_at":"2024-09-16T12:10:17.000Z","size":506,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T20:07:19.025Z","etag":null,"topics":["eda","kafka","kafka-streams","stream-processing"],"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/ibm-cloud-architecture.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":"2020-09-10T23:22:30.000Z","updated_at":"2022-04-19T00:25:48.000Z","dependencies_parsed_at":"2025-04-22T20:00:53.045Z","dependency_job_id":"2060c2d4-e296-4cbe-b1a1-691072ce00ee","html_url":"https://github.com/ibm-cloud-architecture/refarch-eda-item-inventory","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ibm-cloud-architecture/refarch-eda-item-inventory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibm-cloud-architecture%2Frefarch-eda-item-inventory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibm-cloud-architecture%2Frefarch-eda-item-inventory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibm-cloud-architecture%2Frefarch-eda-item-inventory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibm-cloud-architecture%2Frefarch-eda-item-inventory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibm-cloud-architecture","download_url":"https://codeload.github.com/ibm-cloud-architecture/refarch-eda-item-inventory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibm-cloud-architecture%2Frefarch-eda-item-inventory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263130439,"owners_count":23418282,"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":["eda","kafka","kafka-streams","stream-processing"],"created_at":"2024-11-17T00:08:08.971Z","updated_at":"2025-07-02T11:33:11.657Z","avatar_url":"https://github.com/ibm-cloud-architecture.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Item sold aggregator component\n\nThis project illustrates combining Kafka Streams with reactive programming, and reactive messaging with Quarkus.\nThe goal of the Kafka streams implementation is to build a real time inventory view from items sold in different stores. The aggregates are kept in state store and exposed via interactive queries.\n\nThe project is used as a Kafka Streams lab [documented here](https://ibm-cloud-architecture.github.io/refarch-eda/use-cases/kafka-streams/lab-3/) with instructions to deploy and run it on OpenShift.\n\nHere is a simple diagram to illustrate the components used:\n\n ![1](https://github.com/ibm-cloud-architecture/refarch-eda/blob/master/docs/src/pages/use-cases/kafka-streams/lab-3/images/inventory-components.png)\n\nThe goal of this note is to present how to run this item inventory aggregartor locally using Strimzi Kafka image and instructions to build it.\n\nUpdated 01/25/2021\n\n* move to quarkus 2.6.3\n\u003e quarkus dev   does not work.\n\nUpdated 06/09/2021\n\n## Pre-requisites\n\nFor development purpose the following pre-requisites need to be installed on your working computer:\n\n**Java**\n- For the purposes of this lab we suggest Java 11+\n- Quarkus (on version 1.13.x)\n\n**Git client**\n\n**Maven**\n- Maven will be needed for bootstrapping our application from the command-line and running\nour application.\n\n**Docker**\n\nIf you want to access the end solution clone the following git repository: `git clone https://github.com/ibm-cloud-architecture/refarch-eda-item-inventory`.\n\n## In a hurry, just run it locally\n\n* Start local Kafka: `docker-compose  up -d` to start one Kafka broker, and two item-inventory service instances. \n* Created the `items` and `item.inventory` topics on your Kafka instance\n \n ```shell\n ./scripts/createTopics.sh \n######################\n create Topics\nCreated topic items.\nCreated topic item.inventory.\n\n./scripts/listTopics.sh \n######################\n List Topics\nitem.inventory\nitems\n ```\n\n* Verify each components runs well with `docker ps`:\n\n```sh\nCONTAINER ID   IMAGE                                      PORTS                     NAMES\n2c2959bbda15   obsidiandynamics/kafdrop                   0.0.0.0:9000-\u003e9000/tcp    kafdrop\n3e569f205f6f   cp.icr.io/cp/ibm-eventstreams-kafka:10.5.0 0.0.0.0:29092-\u003e9092/tcp   kafka\n0cf09684b675   cp.icr.io/cp/ibm-eventstreams-kafka:10.5.0 0.0.0.0:2181-\u003e2181/tcp    zookeeper\nd4f74a23cf6c   quay.io/ibmcase/eda-store-simulator:0.0.10 0.0.0.0:8081-\u003e8080/tcp    simulator\n```\n\n* Start the app in dev mode: `quarkus dev`\n* do a POST on the simulator to generate 9 records\n\n```sh\ncurl -X POST   -H 'accept: application/json' -H 'Content-Type: application/json' http://localhost:8081/api/stores/v1/startControlled -d '{ \"records\": 1, \"backend\": \"KAFKA\"}'  \n```\n\nThe trace inside the item inventory code should list:\n\n```sh\n[KTABLE-TOSTREAM-0000000006]: Item_2, { itemID: Item_2 -\u003e 0\n[KTABLE-TOSTREAM-0000000006]: Item_3, { itemID: Item_3 -\u003e 10\n[KTABLE-TOSTREAM-0000000006]: Item_1, { itemID: Item_1 -\u003e 50\n```\n\nThen [see the demonstration](#demonstration-script) script section below to test the application.\n\n## Demonstration script\n\nOnce started go to one of the Item Aggregator API: [swagger-ui/](http://localhost:8080/q/swagger-ui/) and \nthe `/api/v1/items/{itemID}` end point. Using the `Item_1` as itemID you should get an empty response.\n\n* Send some item sale simulated records with `curl` on the simulator APIs: `curl -X POST http://localhost:8082/start -d '20'` or using the user interface at []()\n\n  ![](./docs/store_simulator.png)\n\n* Use [Kafdrop UI](http://localhost:9000/) to see messages in `items` topic.\n\n  ![](./docs/kafdrop_items.png)\n\n* Verify the store inventory is updated: `curl -X GET \"http://localhost:8080/api/v1/items/Item_2\" -H  \"accept: application/json\"`\n* Verify messages are sent to `item.inventory` topic by \n\n  ![](./docs/kafdrop_item_inventory.png)\n\n**Remark: after the item aggregator consumes some items, you should see some new topics created, used to persist the \nthe item store.**\n\n## Developing the application from A to Z\n\nTo develop the same type of application see [this specific note](./docs/dev-app.md). It also includes some testing tools\nfor integration tests.\n\n\n## Deploy on OpenShift cluster with Kafka Strimzi\n\nThe instructions to deploy the complete real time inventorty solution is desceribed in [this Kafka Stream lab](https://ibm-cloud-architecture.github.io/refarch-eda/use-cases/kafka-streams/lab-3/). It uses gitops and a unique script\nto deploy Kafka, configure topic, users and deploy the components.\n\n## Continuous integration with OpenShift Pipelines\n\n* Create a `rt-inventory-gitops` OpenShift project to execute pipeline\n* Be sure the OpenShift pipelines operator is deployed if not do:\n\n  ```sh\n  oc apply -f https://raw.githubusercontent.com/ibm-cloud-architecture/eda-lab-inventory/master/environments/openshift-pipelines/operator.yaml\n  ```\n  \n* Install the needed tasks to build app (some are provided as clustertask, some need updates): \n\n  ```sh\n  oc apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/maven/0.2/maven.yaml\n  ```\n\n* Defines resources and pipeline:\n\n ```sh\n oc apply -k build/resource.yaml\n ```\n\n* Execute the pipeline:\n\n  ```sh\n  oc create -f build/pipelinerun.yaml\n  ```\n\n  you should get this result:\n  \n  ![](./docs/quarkus-pipeline.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud-architecture%2Frefarch-eda-item-inventory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibm-cloud-architecture%2Frefarch-eda-item-inventory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud-architecture%2Frefarch-eda-item-inventory/lists"}