A better approach could have been using Haversine Formula (using radius of earth and angle between two places : Wikipedia - Reference) ,we could find the distance between two places using latitutde and longitude. Then based on Rural, City, Highway segment of the road and traffic factor we could assign values:
- Segment 1 (City): 10 miles, average speed 20 mph, traffic factor 2.0
- Segment 2 (Highway): 30 miles, average speed 60 mph, traffic factor 1.2
- Segment 3 (Rural): 10 miles, average speed 50 mph, traffic factor 1.0
Using Rabbit MQ we used 3 topic-exchange : shipping, onroad, delivered .The status will get updated as the parcel moves from one city to another and it is consumed by the consumers. Finally when the parcel reaches the destination , a mail will be sent to pick up the delivery. The Live location is tracked using socket