1) Real time order tracking status.
2) customer/business can view the status
3) Notification update to the customer of order status.
1) Highly Available.
2) Scalable
3) Security
1 ) 10 Million order placed daily .
total storage to keep the order status data can be assumed as 500 bytes
Daily Storage/day = 10 Million *500 bytes = 5 GB
for 5 years = 5*365*5GB = 9 TB
1) Order View:
GET /api/vi/orderStatus/{order_id}/{product_id}
Reponse : Gives the exact status of the order for the specific product
Order Table:
order_id = uuid
product_id = uuid
user_id = uuid
status = string
create_date = sysdate
primarkey will be (order_id,product_id)
index the table based on created date
I) We have two flow in one for the flow the order service ,Warehouse ,shipping services are updating the changes in Kafka and then it gets updated in database .
2) Another Kafka topic listen to data base change and update the Materlized view and the order view service reads the data from materlized views and show the current status of order.
3) Also kafka send the notification via push message to user by giving the users current order status.
The whole idea of getting the real time update of order status by using broad cast mechanism where each of the services changes are updated in Kafka and then order status get the updates in asynchronous way. This improves the services to be low coupling and highly available.
We have used the Materlized view to fetch the order status by using CQRS pattern .
For future we can use Kafka streams to fetch near real time status of order where the order status is updated using streams API and being calculated the status real time.