FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge branch 'master' of https://github.com/javaHelper/saga · javaHelper/saga@d098bfe · GitHub

Commit d098bfe

Browse files
committed
Merge branch 'master' of https://github.com/javaHelper/saga
2 parents 101d9b8 + f529995 commit d098bfe

1 file changed

Lines changed: 117 additions & 0 deletions

File tree

‎saga-choreography-itnext/readme.md‎

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
![image](https://user-images.githubusercontent.com/54174687/121066835-f6632e80-c7e7-11eb-8c3e-9c7aa10c7c3e.png)
107+
108+
![image](https://user-images.githubusercontent.com/54174687/121066914-0ed34900-c7e8-11eb-9a3e-4a58738b6c71.png)
109+
110+
![image](https://user-images.githubusercontent.com/54174687/121066964-1d216500-c7e8-11eb-999f-bd34980b50ca.png)
111+
112+
113+
# Architecture
114+
115+
![image](https://user-images.githubusercontent.com/54174687/121066098-278f2f00-c7e7-11eb-8527-0d7298f30997.png)
116+
117+

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL