I have a microservice based application like so:
User.Microservice - stores , user information.
Product.Microservice - stores products that user created.
Order.Microservices - stores product orders
RabbitMQ - for Event based communication
MongoDB - for Data Storage
Each service has a public HTTP REST API.
Each service can publish and consume messages from Rabbit MQ.
Client makes a request to API gateway:
lets suppose client makes a
POST request to product service -> the product has user reference and other details about a product.
Well now if I want to populate product item with user details such as user's username, the API gateway should make a
GET request to user service.
Here comes the data replication part i have to add the required information about user to product service.
How can i replicate user details to product service after a product is created ?
And return the response to
POST request along with user's username ? if it is not present in product service...
I could use the current API gateway method where the gateway calls user service , but if the user service goes down i will not have the required user details...
Somehow i need to run bus events before the response from
POST request is returned...