{"id":17609597,"url":"https://github.com/melloware/quarkus-temporal-petstore","last_synced_at":"2025-04-13T19:51:58.813Z","repository":{"id":259018192,"uuid":"845619246","full_name":"melloware/quarkus-temporal-petstore","owner":"melloware","description":"Temporal purchase order end-to-end demo using Quarkus","archived":false,"fork":false,"pushed_at":"2025-03-15T18:56:25.000Z","size":3371,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T10:37:50.845Z","etag":null,"topics":["microservices","quarkus","temporal"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/melloware.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":"2024-08-21T15:41:02.000Z","updated_at":"2025-03-15T18:56:28.000Z","dependencies_parsed_at":"2025-03-06T16:36:23.199Z","dependency_job_id":null,"html_url":"https://github.com/melloware/quarkus-temporal-petstore","commit_stats":null,"previous_names":["melloware/quarkus-temporal-petstore"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melloware%2Fquarkus-temporal-petstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melloware%2Fquarkus-temporal-petstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melloware%2Fquarkus-temporal-petstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melloware%2Fquarkus-temporal-petstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melloware","download_url":"https://codeload.github.com/melloware/quarkus-temporal-petstore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248773837,"owners_count":21159520,"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":["microservices","quarkus","temporal"],"created_at":"2024-10-22T17:09:15.855Z","updated_at":"2025-04-13T19:51:58.806Z","avatar_url":"https://github.com/melloware.png","language":"HTML","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/melloware/temporal-purchase-order/blob/main/docs/quarkus-petstore-logo.png\" width=\"400\" height=\"294\" \u003e\n  \n# Quarkus Temporal Petstore\n\u003c/div\u003e\n\n[![Quarkus](https://img.shields.io/badge/quarkus-power-blue?logo=quarkus\u0026style=for-the-badge)](https://github.com/quarkusio/quarkus)\n[![License](https://img.shields.io/badge/License-Apache%202.0-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)\n\nQuarkus Temporal Petstore is a comprehensive demonstration using Quarkus and Temporal. It simulates placing a new order on your Petstore website and fulfilling it using a microservice architecture.\nThis use case has been featured on [Temporal's Code Exchange](https://temporal.io/code-exchange/quarkus-temporal) catalog.\n\nWhile the code is surprisingly simple, under the hood this is using:\n\n- [Quarkus + Temporal Extension](https://github.com/quarkiverse/quarkus-temporal) for super subatomic microservices\n- [Temporal](https://www.temporal.io/) for indestructible microservices and workflow orchestration\n- [Mailpit](https://mailpit.axllent.org/) email \u0026 SMTP testing tool\n- [PostgresSQL](https://www.postgresql.org/) the world's most advanced open source relational database\n- [Jaeger](https://www.jaegertracing.io/) for distributed tracing using OpenTelemetry\n\n## Overview\n\nThe following workflow is orchestrated across these microservices.\n\n- **PurchaseOrder Gateway Service** receives a new order through a REST service\n- **NotificationService:** Email is sent to the customer notifying them the order has been received and is processing\n- **OrderService:** Order is persisted to the database\n- **PaymentService:** Credit Card is verified as valid with enough funds\n- **WarehouseService:** Warehouse checks if there is enough inventory to fulfill this order\n- **ShipmentService:** Shipment service registers the shipment and creates a tracking number\n- **OrderService:** Order is marked as complete in the database with updated information\n- **NotificationService:** Email is sent to the customer notifying them order is on the way with tracking number\n\nIf anything in this process fails a \"compensating transaction\" must occur with the following steps:\n\n- **PaymentService:** must reverse the payment or release the credit card hold\n- **OrderService:** must update the database with the failure information\n- **NotificationService:** Email is sent to the customer notifying them something went wrong and to call customer service with a reference number.\n\nTemporal handles retrying and waiting for your services to come back up. So it will track the workflow until it is completed or issue a failure if the whole workflow is not completed in time (by default 24 hours).\n\n## Microservices\n\nThe following microservices have been created to simulate this system:\n\n| Service                | Description                                                                               | Port | Dev UI URL                                                         |\n| ---------------------- | ----------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------ |\n| Purchase Order Gateway | Workflow gateway service that starts and manages the workflow when the order is received. | 8082 | [http://localhost:8082/q/dev-ui/](http://localhost:8082/q/dev-ui/) |\n| Notification Service   | Email notifications to customers about order progress, completion, or cancellation.       | 8089 | [http://localhost:8089/q/dev-ui/](http://localhost:8089/q/dev-ui/) |\n| Order Service          | Tracking the order in the database.                                                       | 8090 | [http://localhost:8090/q/dev-ui/](http://localhost:8090/q/dev-ui/) |\n| Payment Service        | Validating the payment such as credit card.                                               | 8086 | [http://localhost:8086/q/dev-ui/](http://localhost:8086/q/dev-ui/) |\n| Warehouse Service      | Validating inventory availability and decrementing inventory.                             | 8989 | [http://localhost:8989/q/dev-ui/](http://localhost:8989/q/dev-ui/) |\n| Shipment Service       | Registering the order with a shipment provider and getting a tracking number.             | 8877 | [http://localhost:8877/q/dev-ui/](http://localhost:8877/q/dev-ui/) |\n\n## Docker Compose\n\nTo run this demo you will need Docker or Podman to run the compose stack. To run it:\n\n```shell\n$ cd docker-compose\n$ docker-compose up -d\n```\n\nThe above will start the following services:\n\n| Service    | Description                                                | Port / URL                                       |\n| ---------- | ---------------------------------------------------------- | ------------------------------------------------ |\n| Temporal   | Temporal server and UI                                     | [http://localhost:8080](http://localhost:8080)   |\n| Mailpit    | SMTP Mail collector to view emails generated by the system | [http://localhost:8025](http://localhost:8025)   |\n| pgAdmin    | Administrative UI for PostgreSQL                           | [http://localhost:16543](http://localhost:16543) |\n| Jaeger     | Distributed OpenTelemetry tracing UI                       | [http://localhost:15000](http://localhost:15000) |\n| PostgreSQL | Database for both the orders and for Temporal storage      | 5432                                             |\n\n## Running Workflow\n\nYou will need to have all 6 services running using `mvn quarkus:dev`, I recommend running them each in their own command prompt window for easy testing and startup/shutdown.\n\nTo start the workflow go to [Gateway Service DevUI](http://localhost:8082/q/dev-ui/) and find the OpenAPI card. There you can use the OpenAPI UI to call the REST Service with the following example payload (make changes as you like):\n\n```js\n{\n  \"creditCard\": {\n    \"cardNumber\": \"4400123487650987\",\n    \"cardHolderName\": \"Homer Simpson\",\n    \"expiryDate\": \"12/25\",\n    \"cvv\": \"372\",\n    \"type\": \"VISA\"\n  },\n  \"customerEmail\": \"homer.simpson@springfield.gov\",\n  \"products\": [\n    {\n      \"sku\": \"DOG-COLLAR-001\",\n      \"quantity\": 5,\n      \"price\": 19.99\n    }\n  ]\n}\n```\n\nYou should see the new Workflow in the Temporal UI as well as both an Order Received and Order Completed emails in the Mailpit UI.\n\n## Induce Failures\n\nThere are a few ways to induce failures in the workflow.\n\n1. **PaymentService ERROR:** Put a `price` of greater than 1000\n1. **PaymentService ERROR:** Put a `customerEmail` of `bad_customer@foo.com`\n1. **WarehouseService ERROR:** Put a `quantity` of greater than 20 over many orders\n\nThese will fail the workflow and trigger the compensating transactions.\n\n## User Interface\n\nNavigate to [http://localhost:8082/](http://localhost:8082/) to view the user interface and submit an order.\n\n[![Petstore UI](https://github.com/melloware/temporal-purchase-order/blob/main/docs/petstore-ui.png)](http://localhost:8082/)\n\n## Infrastructure Diagram\n\n[![Infrastructure Diagram](https://github.com/melloware/temporal-purchase-order/blob/main/docs/quarkus-remote-workflow.png)]()\n\n## State Transition Diagram\n\n[![State Transition Diagram](https://github.com/melloware/quarkus-temporal-petstore/blob/main/docs/state-transition.png)]()\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelloware%2Fquarkus-temporal-petstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelloware%2Fquarkus-temporal-petstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelloware%2Fquarkus-temporal-petstore/lists"}