{"id":36728115,"url":"https://github.com/conductor-sdk/conductor-examples-food-delivery","last_synced_at":"2026-01-12T12:03:42.115Z","repository":{"id":224561489,"uuid":"760529335","full_name":"conductor-sdk/conductor-examples-food-delivery","owner":"conductor-sdk","description":"Food Delivery Service using Orkes Conductor","archived":false,"fork":false,"pushed_at":"2024-02-29T18:16:50.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-02-29T19:32:26.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/conductor-sdk.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}},"created_at":"2024-02-20T15:33:27.000Z","updated_at":"2024-02-26T15:21:29.000Z","dependencies_parsed_at":"2024-02-29T19:41:37.634Z","dependency_job_id":null,"html_url":"https://github.com/conductor-sdk/conductor-examples-food-delivery","commit_stats":null,"previous_names":["conductor-sdk/conductor-examples-food-delivery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/conductor-sdk/conductor-examples-food-delivery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conductor-sdk%2Fconductor-examples-food-delivery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conductor-sdk%2Fconductor-examples-food-delivery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conductor-sdk%2Fconductor-examples-food-delivery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conductor-sdk%2Fconductor-examples-food-delivery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conductor-sdk","download_url":"https://codeload.github.com/conductor-sdk/conductor-examples-food-delivery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conductor-sdk%2Fconductor-examples-food-delivery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"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":"2026-01-12T12:03:42.046Z","updated_at":"2026-01-12T12:03:42.107Z","avatar_url":"https://github.com/conductor-sdk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Food Delivery Service implemented using Conductor\nSample Java Application demonstrating Saga microservice architecture pattern for a food delivery app.\n\n## Running this Example\n\n### Environment setup\n1. Install JAVA 17 - https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html\n2. Install Gradle - https://gradle.org/install/\n3. Generate Gradle Wrapper - https://www.baeldung.com/gradle-wrapper\n4. Install sqlite (Only if necessary, i.e if SQLite JDBC Driver is not installed. If you are on Mac OS X or Linux, then SQLite is normally pre-installed) - https://www.tutorialspoint.com/sqlite/sqlite_installation.htm.\n\n### Workflow Setup on Orkes Playground\n\n#### Use existing out-of-the-box workflows\nWe have already setup these workflows with all the necessary permissions. These can be used directly, if you don't need to modify these workflows.\n1. Food Delivery Workflow - https://play.orkes.io/workflowDef/FoodDeliveryWorkflow\n2. Cancellation workflow - https://play.orkes.io/workflowDef/FoodDeliveryFailureWorkflow\n\n### Running the application and workers locally\n\n1. Clone the project to your local\n2. Update following properties in [application.properties](src/main/resources/application.properties)   \n   1. `conductor.security.client.key-id` and `conductor.security.client.secret` are **NOT** set, please set them\n      * When connecting to playground - refer to this [article](https://orkes.io/content/how-to-videos/access-key-and-secret) to get a key and secret\n      * When connecting locally - follow the instructions [here (Install and Run Locally)](https://orkes.io/content/get-orkes-conductor)\n   2. `conductor.worker.all.domain` is set to 'saga' by default, please change it to \u003cyourname\u003e or something else to avoid conflicts with workflows and workers spun up by others\n3. From the root project folder, run `gradlew bootRun`\n\n### Order Creation\n\nWe can use two approaches:\n1. Call the triggerRideBookingFlow API from within the Application\n   ```\n    curl --location 'http://localhost:8081/triggerFoodDeliveryFlow' \\\n    --header 'Content-Type: application/json' \\\n    --data '{\n        \"customerEmail\": \"tester.qa@example.com\",\n        \"customerName\": \"Tester QA\",\n        \"customerContact\": \"+1(605)123-5674\",\n        \"address\": \"350 East 62nd Street, NY 10065\",\n        \"restaurantId\": 2,\n        \"foodItems\": [\n            {\n                \"item\": \"Chicken with Broccoli\",\n                \"quantity\": 1\n            },\n            {\n                \"item\": \"Veggie Fried Rice\",\n                \"quantity\": 1\n            },\n            {\n                \"item\": \"Egg Drop Soup\",\n                \"quantity\": 2\n            }\n        ],\n        \"additionalNotes\": [\n            \"Do not put spice.\",\n            \"Send cutlery.\"\n        ],\n        \"paymentMethod\" : {\n            \"type\": \"Credit Card\",\n            \"details\": {\n                \"number\": \"1234 4567 3325 1345\",\n                \"cvv\": \"123\",\n                \"expiry\": \"05/2022\"\n            }\n        },\n        \"paymentAmount\": 45.34,\n        \"deliveryInstructions\": \"Leave at the door!\"\n     }'\n   ```\n2. Directly call the Orkes API for creating a workflow\n   1. Generate a JWT token by following steps mentioned [here](https://orkes.io/content/access-control-and-security/applications#generating-token)\n   2. Make an HTTPS request from postman/curl similar to below after replacing \\\u003cJWT Token\\\u003e:\n``` \ncurl --location 'https://play.orkes.io/api/workflow' \\\n--header \"Content-Type: application/json\" \\\n--header 'X-Authorization: \u003cJWT Token\u003e' \\\n--request POST \\\n--data \\\n'\n{\n    \"name\": \"FoodDeliveryWorkflow\",\n    \"version\": 1,\n    \"input\": {\n        \"customerEmail\": \"tester.qa@example.com\",\n        \"customerName\": \"Tester QA\",\n        \"customerContact\": \"+1(605)123-5674\",\n        \"address\": \"350 East 62nd Street, NY 10065\",\n        \"restaurantId\": 2,\n        \"foodItems\": [\n        {\n          \"item\": \"Chicken with Broccoli\",\n          \"quantity\": 1 \n        },\n        {\n          \"item\": \"Veggie Fried Rice\",\n          \"quantity\": 1 \n        }, \n        {\n          \"item\": \"Egg Drop Soup\",\n          \"quantity\": 2\n        }],\n        \"additionalNotes\": [\n            \"Do not put spice.\",\n            \"Send cutlery.\"\n        ],\n        \"deliveryInstructions\": \"Leave at the door!\",\n        \"paymentAmount\": 45.34,\n        \"paymentMethod\": {\n            \"type\" : \"Credit Card\",\n            \"details\" : {\n                \"number\": \"1234 4567 3325 1345\",\n                \"expiry\": \"05/2025\",\n                \"cvv\": \"123\"\n            }\n        }\n    }\n    \"taskToDomain\": {\n        \"*\": \"saga\"\n    }\n}\n'\n```\n   \nA successful order creation workflow run will look like this:\n\n![Screenshot 2024-02-26 at 11 38 14 AM](https://github.com/conductor-sdk/conductor-examples-food-delivery/assets/127052609/377549ec-58b0-425c-922b-6318a20b68c8)\n\n\n#### Triggering the cancellation workflow to simulate rollback of distributed transactions\n\n* Create an order with invalid payment expiry\n``` \ncurl --location 'https://play.orkes.io/api/workflow' \\\n--header \"Content-Type: application/json\" \\\n--header 'X-Authorization: \u003cJWT Token\u003e' \\\n--request POST \\\n--data \\\n'\n{\n    \"name\": \"FoodDeliveryWorkflow\",\n    \"version\": 1,\n    \"input\": {\n        \"customerEmail\": \"tester.qa@example.com\",\n        \"customerName\": \"Tester QA\",\n        \"customerContact\": \"+1(605)123-5674\",\n        \"address\": \"350 East 62nd Street, NY 10065\",\n        \"restaurantId\": 2,\n        \"foodItems\": [\n        {\n          \"item\": \"Chicken with Broccoli\",\n          \"quantity\": 1 \n        },\n        {\n          \"item\": \"Veggie Fried Rice\",\n          \"quantity\": 1 \n        }, \n        {\n          \"item\": \"Egg Drop Soup\",\n          \"quantity\": 2\n        }],\n        \"additionalNotes\": [\n            \"Do not put spice.\",\n            \"Send cutlery.\"\n        ],\n        \"deliveryInstructions\": \"Leave at the door!\",\n        \"paymentAmount\": 45.34,\n        \"paymentMethod\": {\n            \"type\" : \"Credit Card\",\n            \"details\" : {\n                \"number\": \"1234 4567 3325 1345\",\n                \"expiry\": \"05/2022\",\n                \"cvv\": \"123\"\n            }\n        }\n    }\n    \"taskToDomain\": {\n        \"*\": \"saga\"\n    }\n}\n'\n```\n\n* This will cause the workflow to fail and trigger the cancellation workflow.\n* Failed workflow run will look like this:\n\n![Screenshot 2024-02-26 at 1 14 02 PM](https://github.com/conductor-sdk/conductor-examples-food-delivery/assets/127052609/6078320f-f4d6-406e-98b9-7df110c70cb3)\n\n\n\n* A cancellation workflow run will look like this:\n\n![Screenshot 2024-02-26 at 1 15 07 PM](https://github.com/conductor-sdk/conductor-examples-food-delivery/assets/127052609/68c15035-82c1-4415-b502-93217ce40c80)\n\n\n* In the above workflow diagram, the simulated distributed rollback can be seen. The rollback sequence in case of failure occurring while payment processing is as follows:\n  1. Shipment is cancelled in the Shipment Service\n  2. Payment is cancelled in the Payment Service\n  3. Order is cancelled in the Order Service\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconductor-sdk%2Fconductor-examples-food-delivery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconductor-sdk%2Fconductor-examples-food-delivery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconductor-sdk%2Fconductor-examples-food-delivery/lists"}