| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,117 @@ | |||
| 1 | + | ||
| 2 | + | ||
| 3 | + # Step | ||
| 4 | + | ||
| 5 | + https://itnext.io/microservices-architecture-an-implementation-of-saga-pattern-dbbe5d881c78 | ||
| 6 | + | ||
| 7 | + | ||
| 8 | + # Swagger URLs | ||
| 9 | + | ||
| 10 | + - Order Service - http://localhost:8090/swagger-ui.html | ||
| 11 | + - Delivery Service - http://localhost:8070/swagger-ui.htm | ||
| 12 | + - Kitchen Service - http://localhost:8080/swagger-ui.html | ||
| 13 | + | ||
| 14 | + # Techlogies Used | ||
| 15 | + | ||
| 16 | + - Java 8 | ||
| 17 | + - Spring Boot v2.4.5 | ||
| 18 | + - MongoDB | ||
| 19 | + - Saga Choreography | ||
| 20 | + - Swagger | ||
| 21 | + | ||
| 22 | + # Steps | ||
| 23 | + | ||
| 24 | + When you execute the code make sure `db.getCollection('hamburger').find({})` should hold multiple records of same type like below | ||
| 25 | + | ||
| 26 | + ``` | ||
| 27 | + /* 1 */ | ||
| 28 | + { | ||
| 29 | + "_id" : ObjectId("60be54182ff7ef03f3f397c0"), | ||
| 30 | + "hamburgerType" : "SCOTTONA", | ||
| 31 | + "_class" : "com.example.demo.entity.Hamburger" | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /* 2 */ | ||
| 35 | + { | ||
| 36 | + "_id" : ObjectId("60be542a2ff7ef03f3f397c1"), | ||
| 37 | + "hamburgerType" : "CHIANINA", | ||
| 38 | + "_class" : "com.example.demo.entity.Hamburger" | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /* 3 */ | ||
| 42 | + { | ||
| 43 | + "_id" : ObjectId("60be56d62ff7ef03f3f397c8"), | ||
| 44 | + "hamburgerType" : "ANGUS", | ||
| 45 | + "_class" : "com.example.demo.entity.Hamburger" | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /* 4 */ | ||
| 49 | + { | ||
| 50 | + "_id" : ObjectId("60be56db2ff7ef03f3f397c9"), | ||
| 51 | + "hamburgerType" : "ANGUS", | ||
| 52 | + "_class" : "com.example.demo.entity.Hamburger" | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /* 5 */ | ||
| 56 | + { | ||
| 57 | + "_id" : ObjectId("60be56de2ff7ef03f3f397ca"), | ||
| 58 | + "hamburgerType" : "ANGUS", | ||
| 59 | + "_class" : "com.example.demo.entity.Hamburger" | ||
| 60 | + } | ||
| 61 | + ``` | ||
| 62 | + # Create Order | ||
| 63 | + | ||
| 64 | + ``` | ||
| 65 | + curl -X POST "http://localhost:8090/order/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"addressDTO\": { \"number\": \"100\", \"street\": \"Achalpur Street\" }, \"cookingType\": \"BLOOD\", \"hamburgerList\": [ { \"hamburgerType\": \"ANGUS\", \"quantity\": 2 } ], \"orderStatus\": \"COOKING\", \"price\": 110, \"statusDescription\": \"Waiting Status\"}" | ||
| 66 | + ``` | ||
| 67 | + Below things should happe in MongoDB | ||
| 68 | + | ||
| 69 | + db.getCollection('order').find({}) | ||
| 70 | + | ||
| 71 | + ``` | ||
| 72 | + { | ||
| 73 | + "_id" : ObjectId("60be57704123a3150882f9bd"), | ||
| 74 | + "statusDescription" : "WAITING", | ||
| 75 | + "cookingType" : "BLOOD", | ||
| 76 | + "orderStatus" : "WAITING", | ||
| 77 | + "hamburgerList" : [ | ||
| 78 | + { | ||
| 79 | + "hamburgerType" : "ANGUS", | ||
| 80 | + "quantity" : 2 | ||
| 81 | + } | ||
| 82 | + ], | ||
| 83 | + "addressDTO" : { | ||
| 84 | + "number" : "100", | ||
| 85 | + "street" : "Achalpur Street" | ||
| 86 | + }, | ||
| 87 | + "price" : 110.0, | ||
| 88 | + "_class" : "com.example.demo.entity.Order" | ||
| 89 | + } | ||
| 90 | + ``` | ||
| 91 | + | ||
| 92 | + db.getCollection('delivery').find({}) | ||
| 93 | + | ||
| 94 | + ``` | ||
| 95 | + { | ||
| 96 | + "_id" : ObjectId("60be581f850eb81c07e6b342"), | ||
| 97 | + "addressDTO" : { | ||
| 98 | + "number" : "100", | ||
| 99 | + "street" : "Achalpur Street" | ||
| 100 | + }, | ||
| 101 | + "orderId" : "60be57704123a3150882f9bd", | ||
| 102 | + "_class" : "com.example.demo.entity.Delivery" | ||
| 103 | + } | ||
| 104 | + ``` | ||
| 105 | + | ||
| 106 | +  | ||
| 107 | + | ||
| 108 | +  | ||
| 109 | + | ||
| 110 | +  | ||
| 111 | + | ||
| 112 | + | ||
| 113 | + # Architecture | ||
| 114 | + | ||
| 115 | +  | ||
| 116 | + | ||
| 117 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments