Build:
docker build user_service --tag user-service:1.0
docker build payment_service --tag payment-service:1.0
Run:
kubectl apply -f rabbitmq/rabbitmq-deployment.yaml
kubectl apply -f user_service/deployment.yaml
kubectl appply -f payment_service/deployment.yaml
Rabbitmq:
- Check all payments/users
{"reply_to_exchange": "worker", "reply_to_routing_key": "worker"}
- Add user
{"id": 1, "first_name": "John", "last_name": "Doe", "money": 300}
- Add payment
{"id": 1, "amount": 100, "user_id": 1}
Process:
payment_service.pay
initializes paymentpayment_service.pay
asksuser_service.has_money
user_service.has_money
responses topayment_service.pay_checked
- if user has money then
payment_service.pay_checked
asksuser_service.reduce_money
and sets status ACCEPTED - if user has not money then
payment_service.pay_checked
sets status REJECTED