{"id":20971636,"url":"https://github.com/kjpar0317/java-msa-kafka-saga","last_synced_at":"2026-04-21T08:03:16.895Z","repository":{"id":119084528,"uuid":"592611584","full_name":"kjpar0317/java-msa-kafka-saga","owner":"kjpar0317","description":"springboot(3.X) netflix-cloud kafka saga jdk19","archived":false,"fork":false,"pushed_at":"2023-01-25T16:08:00.000Z","size":661,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T18:27:45.901Z","etag":null,"topics":["jdk19","kafka","msa","saga","spring-cloud-netflix"],"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/kjpar0317.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-24T05:37:45.000Z","updated_at":"2024-11-15T11:41:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb9f0a0d-1a11-4963-8839-4dc3e5f20e85","html_url":"https://github.com/kjpar0317/java-msa-kafka-saga","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kjpar0317/java-msa-kafka-saga","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjpar0317%2Fjava-msa-kafka-saga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjpar0317%2Fjava-msa-kafka-saga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjpar0317%2Fjava-msa-kafka-saga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjpar0317%2Fjava-msa-kafka-saga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kjpar0317","download_url":"https://codeload.github.com/kjpar0317/java-msa-kafka-saga/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjpar0317%2Fjava-msa-kafka-saga/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32082781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"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":["jdk19","kafka","msa","saga","spring-cloud-netflix"],"created_at":"2024-11-19T04:04:25.751Z","updated_at":"2026-04-21T08:03:16.890Z","avatar_url":"https://github.com/kjpar0317.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# java-msa-kafka-saga\nspringboot(3.X) netflix-cloud kafka saga  \nin-text citations: https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/\n\n[\u003cimg src=\"[https://www.vinsguru.com/wp-content/uploads/2022/01/Add-a-little-bit-of-body-text.png](https://www.vinsguru.com/wp-content/uploads/2022/02/Add-a-little-bit-of-body-text-1.png)\"\u003e](https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/)\n\n## A Simple Transaction:\nLet’s assume that our business rule says, when a user places an order, order will be fulfilled if the product’s price is within the user’s credit limit/balance \u0026 the inventory is available for the product. Otherwise it will not be fulfilled. It looks really simple. This is very easy to implement in a monolith application. The entire workflow can be considered as 1 single transaction. It is easy to commit / rollback when everything is in a single DB. With distributed systems with multiple databases, It is going to be very complex! Let’s look at our architecture first to see how to implement this.\n\n[\u003cimg src=\"https://www.vinsguru.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-11-16-33-05.png\"\u003e](https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/)\n\nWe have below Microservices with its own DB.\n\norder-service\npayment-service\ninventory-service\nWhen the order-service receives the request for the new order, It has to check with the payment-service \u0026 inventory-service. We deduct the payment, inventory and fulfill the order finally! What will happen if we deducted payment but if inventory is not available? How to roll back? It is difficult when multiple databases are involved.\n[\u003cimg src=\"https://www.vinsguru.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-11-16-44-17.png\"\u003e](https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/)\n\n## Saga Pattern:\nEvent Sourcing:\nIn this approach every change to the state of an application is captured as an event. This event is stored in the database/event store (for tracking purposes) and is also published in the event-bus for other parties to consume.\n[\u003cimg src=\"https://www.vinsguru.com/wp-content/uploads/2020/04/Screenshot-from-2020-07-11-21-38-45.png\"\u003e](https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/)\n\nThe order-service receives a command to create a new order. This request is processed and raised as an order-created event. Couple of things to note here.\n\nOrderCreated event basically informs that a new order request has been received and kept in the PENDING/CREATED status by order-service. It is not yet fulfilled.\nThe event object will be named in the past tense always as it already happened!\nNow the payment-service/inventory-service could be interested in listening to those events and reserve/reject payment/inventory. Even these could be treated as an event. Payment reserved/rejected event. Order-service might listen to these events and fulfill / cancel the order request it had originally received.\n\nThis approach has many advantages.\n\nThere is no service dependency. payment-service \u0026 inventory-services do not have to be up and running always.\nLoose coupling\nHorizontal scaling\nFault tolerant\n\nChoreography Saga Pattern\n\n[\u003cimg src=\"https://www.vinsguru.com/wp-content/uploads/2020/12/Screenshot-from-2021-01-28-13-09-26-1024x500.png\"\u003e](https://www.vinsguru.com/orchestration-saga-pattern-with-spring-boot/)\n\nThe business workflow is implemented as shown here.\n\norder-services receives a POST request for a new order\nIt places an order request in the DB in the ORDER_CREATED state and raises an event\npayment-service listens to the event, confirms about the credit reservation\ninventory-service also listens to the order-event and conforms the inventory reservation\norder-service fulfills order or rejects the order based on the credit \u0026 inventory reservation status.\n\n\n## INSTALL\nhttps://kafka.apache.org/downloads\n  \n1. zookeeper run  \n{{kafka folder}}\\bin\\windows\\zookeeper-server-start.bat config\\zookeeper.properties  \n2. kafka run  \n{{kafka folder}}\\bin\\windows\\kafka-server-start.bat config\\server.properties  \n  \n[[https://www.graalvm.org/  ](https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-22.3.0)](https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-22.3.0)  \n1. jdk19 install\n\nhttps://gradle.org/releases/  \n1. gradle 7.6 install\n\n## TEST\n1. http://localhost:8070/order/create [POST]\n```\n{\n    \"orderId\": \"u100023123\",\n    \"userId\": \"TEST\",\n    \"productId\": \"BASDFASDFASDFASFD\",\n    \"productPrice\": 1000.00   \n}\n```\n2. http://localhost:8070/order [GET]\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjpar0317%2Fjava-msa-kafka-saga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjpar0317%2Fjava-msa-kafka-saga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjpar0317%2Fjava-msa-kafka-saga/lists"}