Food Delivery App
A distributed food delivery system implemented in Java using a MapReduce-like architecture for efficient store searching and order processing.
Architecture
The system follows a distributed architecture with the following components:
- Master: Central coordinator that manages communication between clients and workers
- Workers: Distributed nodes that process store data and handle operations
- Reducer: Aggregates results from multiple workers
- Clients: End users who can search for stores and place orders
- Manager: Administrative interface for store and product management
Features
For Customers
- Search for nearby stores based on location (within specified radius)
- Filter stores by:
- Food categories
- Minimum rating
- Price category
- View store products and place orders
- Rate stores
For Store Managers
- Add new stores with JSON configuration
- Add/Update products
- Remove products or update quantities
- View sales statistics by:
- Store type
- Product category
Code Structure
Core Components
Master.java: Main server that coordinates communicationWorker.java: Distributed processing nodesReducer.java: Result aggregation serviceClient.java: Customer interfaceManager.java: Store management interface
Models
Store.java: Store entity with location and rating infoProduct.java: Product details and inventoryPurchase.java: Order informationMapReduceRequest.java: Search/filter request format
Supporting Classes
Actions.java: Request handling logic for MasterWorkerActions.java: Request processing logic for WorkersReducerActions.java: Aggregation logic for ReducerStoreData.java: JSON parsing and store data management
Data Format
Stores are configured using JSON files with the following structure:
{
"StoreName": "store name",
"Latitude": 00.000000,
"Longitude": 00.000000,
"FoodCategory": "category",
"Stars": 0,
"NoOfVotes": 0,
"StoreLogo": "",
"Products": [
{
"ProductName": "product name",
"ProductType": "category",
"Available Amount": 0,
"Price": 0.00
}
]
}Getting Started
- Start the Reducer server:
- Start one or more Worker nodes:
- Start the Master server with Worker addresses:
java Master <worker1_ip> <worker1_port> <worker2_ip> <worker2_port> ...
- Run the Client or Manager application:
java Client
# or
java ManagerDependencies
- Java 8 or higher
- json-simple-1.1.1.jar for JSON processing
Configuration
The system uses the following default ports:
- Master: 4321
- Reducer: 4325
- Workers: User-specified ports passed as arguments
Contributing
Feel free to submit issues and enhancement requests.