Figure: Sequence Diagram of Food Delivery Process
Food Delivery Workflow After Ordering: Once a customer places an order using a mobile or web client using the Ordering Service, the order processing workflow could be as follows:
- Ordering Service publishes a Message to the queue about the order so that the downstream services can start processing.
- Notification Services reads message and notifies the corresponding restaurant and the customer that an order is placed and pending their acceptance.
- Once the order is accepted by the restaurant then the Order Management Service will publish a Message to the queue regarding the acceptance of the order.
- Dispatch Service will read the Message and post an area-specific Message to the queue. Dispatch Service auto-assign an order to an available Delivery Man based on a matching algorithm and will publish a related Message.
- Notification Service will read message and notify the customer that the restaurant accepted the order. And Notification Service will read message and notify the Delivery Man in the area about the availability of the order to process.
- Once a Delivery Man will accept the order then Dispatch Service will then post a Message to the queue about Delivery Man assignment or acceptance.
- Notification Service will read message and notify the customer and the restaurant about the Delivery Man assignment. And the restaurant publishes a Message to the queue regarding Food is preparing.
- Once the food is ready to be picked up, the restaurant will update the status of the order using Order Management Service and Order Management Service will post a Message to the queue that the food is ready to be picked up.
- Notification Service will read Message and notify the assigned Delivery Man as well as the customer that the food is ready to be picked up.
- After the Delivery Man picks up the food, the restaurant staff will update the status of the order using Order Management Service and Order Management Service will then post a Message to the queue that the order has been picked up.
- Notification Service reads Message and notifies the customer that the order is picked up and on the way.
- Delivery Man reaches the customer, delivers the food, and marks the order as complete and the food is delivered. Dispatch Service posts a Message to the queue about delivery completion.
- Order Management Service reads Message and updates the status of the order to be completed.
- Notification Service reads Message and notifies the restaurant and the customer about the delivery of food.