kafka localhost 로 변경

This commit is contained in:
kimscott
2019-09-23 16:09:38 +09:00
parent 716b01016b
commit 207af25e88
2 changed files with 11 additions and 19 deletions

View File

@@ -47,24 +47,17 @@ public class Order {
}
// 1. 주문에 대한 상품 조회 - API
if( env.getProperty("useRest") != null && "true".equals(env.getProperty("useRest").toLowerCase())){
String productUrl = env.getProperty("productUrl") + "/products/" + productId;
String productUrl = env.getProperty("productUrl") + "/products/" + productId;
ResponseEntity<String> productEntity = restTemplate.getForEntity(productUrl, String.class);
JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(productEntity.getBody()).getAsJsonObject();
ResponseEntity<String> productEntity = restTemplate.getForEntity(productUrl, String.class);
JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(productEntity.getBody()).getAsJsonObject();
this.setPrice(jsonObject.get("price").getAsInt());
this.setProductName(jsonObject.get("name").getAsString());
this.setPrice(jsonObject.get("price").getAsInt());
this.setProductName(jsonObject.get("name").getAsString());
}else{
// 2. 자체 DB 조회
ProductRepository productRepository = Application.applicationContext.getBean(ProductRepository.class);
Optional<Product> productOptional = productRepository.findById(productId);
Product product = productOptional.get();
this.setPrice(product.getPrice());
this.setProductName(product.getName());
if( jsonObject.get("stock").getAsInt() < getQuantity()){
throw new RuntimeException("No Available stock!");
}
OrderPlaced orderPlaced = new OrderPlaced();

View File

@@ -3,13 +3,12 @@ server:
eventTopic: eventTopic
useRest : false
---
spring:
profiles: default
kafka:
bootstrap-servers: http://35.200.47.242:31090
# bootstrap-servers: localhost:9092
# bootstrap-servers: http://35.200.47.242:31090
bootstrap-servers: localhost:9092
consumer:
enable-auto-commit: true
jpa:
@@ -36,6 +35,6 @@ spring:
consumer:
enable-auto-commit: true
productUrl: http://product:8085
productUrl: http://product:8080
eventTopic: eventTopicDocker