Overview
The InventoryGenerated event is emitted by the Inventory Service when new inventory is created or generated for a product. This event is typically triggered when products are received from suppliers, restocked, or when new inventory records are initialized in the system.
Event Flow
- InventoryService receives new stock from supplier or warehouse
- System validates product information and quantities
- Inventory record is created in the database
InventoryGeneratedevent is emitted- Downstream services (OrdersService, AnalyticsService) receive the event
- Product availability is updated across the system
Schema
Example Payload
{ "eventId": "evt_inv_20240215_001", "timestamp": "2024-02-15T10:30:00Z", "inventoryId": "inv_ABC123XYZ", "productId": "prod_789456", "sku": "SKU-2024-WIDGET-BLUE", "productName": "Premium Widget - Blue", "quantity": 500, "unitCost": 12.50, "totalValue": 6250.00, "currency": "USD", "warehouseId": "wh_MAIN_001", "warehouseName": "Main Distribution Center", "warehouseLocation": "Aisle 12, Shelf 3, Bin 7", "supplierId": "supp_ACME_CORP", "supplierName": "ACME Corporation", "purchaseOrderId": "PO-2024-0123", "batchNumber": "BATCH-2024-02-15-001", "expirationDate": "2025-12-31", "receivedBy": "user_john_doe", "receivedAt": "2024-02-15T09:45:00Z", "status": "active", "metadata": { "source": "manual_entry", "qualityCheck": true, "temperature": 22.5, "humidity": 45 }}Use Cases
- Stock Replenishment: Triggered when new stock arrives from suppliers
- Initial Setup: When setting up inventory for new products
- Bulk Import: When importing inventory from external systems
- Warehouse Transfer: When inventory is transferred between warehouses
Related Events
InventoryAdjusted- When inventory levels are modifiedOutOfStock- When inventory reaches zeroLowStockAlert- When inventory falls below threshold
Event-driven architecture documentation: FlowMart