Reputation: 53
I'm trying to understand how to develop and manage microservice using Spring-Boot. In my situation I'm managing a Restaurant and its Orders, having a List of Products and a order-level DiscountCode. The Products can have their own priced discounted (the owner of the restaurant can set as true the discountedPrice of the product and even let apply the discountcode for the entire order). The part on what i am struggling on is the following: How should I manage the validation for the Order? When an order has been created it should check using the other micro-services to make the order completed and valid to be processed. The steps are:
Should I create a different component that receives the order created and validate them asynchronously (using RabbitMQ) and getting the information from the other microservices? Thanks in advice
Upvotes: 0
Views: 484
Reputation: 356
That's a difficult question, because we did not knwo the domain and the existing services.
Each service should be responible for its own validation. To check if the discount is valid I would prefer that the Discount-Service should do the validation.
If it is same as the order service, the order service should get back the object and validate it after getting the prices.
But it's up to you and your domain.
Upvotes: 1