GitHub - TalenticaSoftware/k8-ws-java
Goal:
This application simulates the process of ordering coffee. The Order Service handles customer orders, while the Inventory Service manages stock availability. When a customer places an order, the Order Service checks with the Inventory Service to confirm if the requested coffee ingredients are in stock.
---
2. **Service 2: Inventory Service**
- **Purpose:** Manages stock for ingredients (e.g., coffee beans, milk, syrups).
- **Responsibilities:**
- Checks if the required ingredients are available for a given coffee type.
- Updates stock levels after a successful order.
- Provides available coffee alternatives when stock is insufficient.
**Sample Endpoints:**
- `GET /inventory/stock` – Returns the available stock of all the ingredients.
- `POST /inventory/used` – Reduce the stock of the specify ingredients.
**Example Response (GET /inventory/stock):**
```json
{
"espressoShot": {
"name": "Espresso Shot",
"quantity": 10
},
"milk": {
"name": "Milk",
"quantity": 1000
},
"hotWater": {
"name": "Hot Water",
"quantity": 99999999
},
"milkFoam": {
"name": "Milk Foam",
"quantity": 500
}
}