-
교재: https://www.slideshare.net/pongsor/event-storming-based-msa-training-commerce-example-addhandsonv3
-
실습스크립트 룩업: https://workflowy.com/s/msa/27a0ioMCzlpV04Ib
- 다운로드
https://kafka.apache.org/downloads ==> 최근 버전의 Scala 2.12 버전으로 다운로드
- 이벤트 발행하기
---- window
bin/windows/kafka-console-producer.bat --broker-list http://35.200.47.242:31090 --topic eventTopic
---- mac
bin/kafka-console-producer --broker-list http://35.200.47.242:31090 --topic eventTopic
- 이벤트 수신하기
---- window
bin/windows/kafka-console-consumer.bat --bootstrap-server http://35.200.47.242:31090 --topic eventTopic --from-beginning
---- mac
bin/kafka-console-consumer.sh --bootstrap-server http://35.200.47.242:31090 --topic eventTopic --from-beginning
- (새창)주키퍼 실행 bin/windows/zookeeper-server-start.bat config/zookeeper.properties
- (새창)카프카 실행 bin/windows/kafka-server-start.bat config/server.properties
주문이 발생함 – order
주문이 발생함 - 상품 수량 변경됨 - product
주문이 발생함 - 배송 시작됨 – delivery
배송 시작됨 - 배송 완료됨 – delivery
배송 완료됨 - 상품추천 – marketing
설문조사 - 블랙리스트 추가 - service_center
블랙리스트 추가 - mypage
#### product 서비스 실행시 발생함 - 상품이 입력됨
{"eventType":"ProductChanged","timestamp":"20190905150002","stateMessage":"상품 변경이 발생함","productId":1,"productName":"TV","productPrice":10000,"productStock":10,"imageUrl":"https://github.githubassets.com/images/modules/profile/profile-joined-github.png"}
{"eventType":"ProductChanged","timestamp":"20190905150002","stateMessage":"상품 변경이 발생함","productId":2,"productName":"RADIO","productPrice":20000,"productStock":20,"imageUrl":"https://github.githubassets.com/images/modules/profile/profile-joined-github.png"}
{"eventType":"ProductChanged","timestamp":"20190905150002","stateMessage":"상품 변경이 발생함","productId":3,"productName":"NOTEBOOK","productPrice":30000,"productStock":30,"imageUrl":"https://github.githubassets.com/images/modules/profile/profile-joined-github.png"}
{"eventType":"ProductChanged","timestamp":"20190905150002","stateMessage":"상품 변경이 발생함","productId":4,"productName":"TABLE","productPrice":40000,"productStock":40,"imageUrl":"https://github.githubassets.com/images/modules/profile/profile-joined-github.png"}
{"eventType":"ProductChanged","timestamp":"20190905150002","stateMessage":"상품 변경이 발생함","productId":5,"productName":"CLOCK","productPrice":50000,"productStock":50,"imageUrl":"https://github.githubassets.com/images/modules/profile/profile-joined-github.png"}
#### http localhost:8081/orders productId=1 quantity=3 customerId="[email protected]" customerName="홍길동" customerAddr="서울시" 입력시 발생함
{"eventType":"OrderPlaced","timestamp":"20190916151922","stateMessage":"주문이 발생함","productId":2,"orderId":3,"productName":"RADIO","quantity":3,"price":20000,"customerId":"[email protected]","customerName":"홍길동","customerAddr":"서울시"}
{"eventType":"DeliveryStarted","timestamp":"20190916151922","stateMessage":"배송이 시작됨","deliveryId":3,"orderId":3,"customerId":"[email protected]","customerName":"홍길동","deliveryAddress":"서울시","deliveryState":"DeliveryStarted"}
{"eventType":"ProductChanged","timestamp":"20190916151922","stateMessage":"상품 변경이 발생함","productId":2,"productName":"RADIO","productPrice":20000,"productStock":14,"imageUrl":"/goods/img/RADIO.jpg"}
{"eventType":"DeliveryCompleted","timestamp":"20190916151922","stateMessage":"배송이 완료됨","deliveryId":3,"orderId":3,"customerId":"[email protected]","customerName":"홍길동","deliveryAddress":"서울시","deliveryState":"DeliveryCompleted"}
#### http http://localhost:8084/surveys customerId="[email protected]" surveyMessage="nonooooo" productSatisfaction=1 입력시 발생함
{"eventType":"SurveyCompleted","timestamp":"20190905150424","stateMessage":"설문이 완료됨","customerName":"[email protected]","surveyMessage":"nonooooo","productSatisfaction":1}
{"eventType":"BlackListAdded","timestamp":"20190905150424","stateMessage":"블랙리스트로 추가됨","customerId":"[email protected]"}
mypage 는 CQRS 모형이며, 그중 READ 부분을 담당한다.
각종 일어난 이벤트들을 받아서, 자신만의 DB 에 저장을 하여 보여주는 서비스이다.
mypage 의 정보는 DB 에 저장을 하여서.. orderid 부분이 안맞을수도 있습니다.
### 유저 정보 조회 -> http http://localhost:8086/users/[email protected]
{
"_links": {
"self": {
"href": "http://localhost:8086/users/[email protected]"
},
"user": {
"href": "http://localhost:8086/users/[email protected]"
}
},
"accountNonExpired": true,
"accountNonLocked": true,
"address": "서울시 논현동",
"credentialsNonExpired": true,
"enabled": true,
"money": 900000,
"nickname": "유엔진",
"role": null
}
### 주문 히스토리 조회 -> http http://localhost:8086/mypage/order/[email protected]
[
{
"deliveryCompleted": true,
"deliveryId": 3,
"deliveryStarted": true,
"nickName": "홍길동",
"orderId": 3,
"payment": 60000,
"productId": 2,
"productName": "RADIO",
"quantity": 3,
"timestamp": "20190916151922",
"userId": "[email protected]"
}
]
-
상품개발팀 같은 경우 event-storming/product 프로젝트에 들어가서 오른쪽 상단의 Fork 버튼 클릭
-
IDE 환경에서 해당 git 소스코드를 clone 받아서 개발 함
git clone https://github.com/event-storming/[username]/products.git
https://github.com/TheOpenCloudEngine/uEngine-cloud/wiki/Httpie-%EC%84%A4%EC%B9%98
http localhost:8081/orders productId=1 quantity=3 customerId="[email protected]" customerName="홍길동" customerAddr="서울시"
order 서비스를 실행할때 product 서비스에서 request 방식으로 재고를 체크하고 싶을때는
mvn spring-boot:run -DcheckStock=true
로 order 서비스를 실행하면 됩니다.