주문시 checkStock 를 체크하도록 변경함
This commit is contained in:
@@ -46,6 +46,7 @@ public class Order {
|
|||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("true".equalsIgnoreCase(env.getProperty("checkStock"))){
|
||||||
// 1. 주문에 대한 상품 조회 - API
|
// 1. 주문에 대한 상품 조회 - API
|
||||||
String productUrl = env.getProperty("productUrl") + "/products/" + productId;
|
String productUrl = env.getProperty("productUrl") + "/products/" + productId;
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ public class Order {
|
|||||||
if( jsonObject.get("stock").getAsInt() < getQuantity()){
|
if( jsonObject.get("stock").getAsInt() < getQuantity()){
|
||||||
throw new RuntimeException("No Available stock!");
|
throw new RuntimeException("No Available stock!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OrderPlaced orderPlaced = new OrderPlaced();
|
OrderPlaced orderPlaced = new OrderPlaced();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ server:
|
|||||||
|
|
||||||
|
|
||||||
eventTopic: eventTopic
|
eventTopic: eventTopic
|
||||||
|
|
||||||
|
## 주문은 product 정보가 필요하다.
|
||||||
|
## checkStock 를 true 로 준다면, product 서비스가 죽어있을때는 주문이 안된다.
|
||||||
|
checkStock: false
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
profiles: default
|
profiles: default
|
||||||
|
|||||||
Reference in New Issue
Block a user