Inventory Service Integration

Overview

Attribute Value
Context Inventory Service
Pattern Conformist
Direction Inbound (Inventory β†’ Process Path)
Protocol Apache Kafka + REST API
Topics inventory.allocation.*

Integration Summary

Inventory Service provides item properties and location data that Process Path uses for routing decisions. Process Path conforms to Inventory’s data model for item characteristics like dimensions, weight, hazmat classification, and sortability.

1
2
3
4
5
6
7
8
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   INVENTORY SERVICE     β”‚         β”‚      PROCESS PATH       β”‚
β”‚                         β”‚         β”‚                         β”‚
β”‚  β€’ Item master data     β”‚  ─────► β”‚  β€’ Path eligibility     β”‚
β”‚  β€’ Allocation tracking  β”‚  Event  β”‚  β€’ Dimension checks     β”‚
β”‚  β€’ Location info        β”‚         β”‚  β€’ Weight routing       β”‚
β”‚  β€’ Lot/Serial tracking  β”‚         β”‚  β€’ Hazmat handling      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Events Consumed

InventoryAllocatedEvent

Purpose: Provides item properties for path eligibility decisions

Topic: inventory.allocation.completed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  "specversion": "1.0",
  "type": "com.paklog.inventory.allocated.v1",
  "source": "/inventory-service",
  "id": "evt-alloc-123456",
  "time": "2025-01-20T09:56:00.000Z",
  "subject": "SHP-123456",
  "data": {
    "shipmentId": "SHP-123456",
    "orderId": "ORD-789012",
    "allocations": [
      {
        "sku": "SKU-WIDGET-001",
        "quantity": 2,
        "warehouseLocation": {
          "warehouse": "WH-001",
          "zone": "ZONE-A",
          "aisle": "A-12",
          "bay": "B-03",
          "shelf": "S-02",
          "bin": "BIN-045"
        },
        "itemProperties": {
          "weight": 1.2,
          "dimensions": {
            "length": 6,
            "width": 4,
            "height": 3
          },
          "fragilityLevel": "FRAGILE",
          "sortabilityClass": "SORTABLE",
          "hazmatClass": null,
          "temperatureRequirement": null
        },
        "lotNumber": "LOT-2025-001",
        "expirationDate": null
      }
    ],
    "allocationCompleteAt": "2025-01-20T09:56:00Z"
  }
}

InventoryShortageEvent

Purpose: Handle allocation failures

Topic: inventory.allocation.shortage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "type": "com.paklog.inventory.shortage.v1",
  "data": {
    "shipmentId": "SHP-123456",
    "orderId": "ORD-789012",
    "shortageItems": [
      {
        "sku": "SKU-WIDGET-001",
        "requestedQuantity": 2,
        "availableQuantity": 0
      }
    ],
    "shortageAt": "2025-01-20T09:56:00Z"
  }
}

REST API Queries

Get Item Properties

Used for on-demand item property lookup when event data is incomplete.

Endpoint: GET /api/v1/inventory/items/{sku}/properties

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "sku": "SKU-WIDGET-001",
  "weight": 1.2,
  "dimensions": {
    "length": 6,
    "width": 4,
    "height": 3
  },
  "fragilityLevel": "FRAGILE",
  "sortabilityClass": "SORTABLE",
  "hazmatClass": null,
  "temperatureRequirement": null,
  "specialHandling": []
}

Get Availability

Used for capacity planning and surge detection.

Endpoint: GET /api/v1/inventory/availability/{sku}


Path Eligibility Rules

Process Path applies these rules based on Inventory data:

Dimension Rules

Condition Singles Path AFE Path Batch/Flow
Max dimension ≀ 18” βœ… Eligible βœ… Eligible βœ… Eligible
Max dimension > 18” βœ… Eligible ❌ Large tray only βœ… Eligible
Max dimension > 24” βœ… Eligible ❌ Ineligible βœ… Eligible

Weight Rules

Condition Singles Path AFE Path Batch/Flow
Weight ≀ 20 lbs βœ… Eligible βœ… Eligible βœ… Eligible
Weight 20-50 lbs βœ… Eligible ⚠️ Large tray βœ… Eligible
Weight > 50 lbs βœ… Special handling ❌ Ineligible βœ… Special handling

Hazmat Rules

Hazmat Class Singles Path AFE Path Batch/Flow
None βœ… Eligible βœ… Eligible βœ… Eligible
Class 1-9 βœ… Isolated ❌ Ineligible βœ… Isolated
ORM-D βœ… Eligible ⚠️ Separate βœ… Eligible

Sortability Rules

Class Singles Path AFE Path Batch/Flow
SORTABLE βœ… Eligible βœ… Eligible βœ… Eligible
NON_SORTABLE βœ… Eligible ❌ Ineligible βœ… Eligible
SPECIAL βœ… Eligible ❌ Ineligible ⚠️ Special wave

Data Mapping

Inventory Field Process Path Field Transformation
itemProperties.weight itemWeight Direct
itemProperties.dimensions maxDimension max(L,W,H)
itemProperties.fragilityLevel fragilityLevel Enum mapping
itemProperties.sortabilityClass sortabilityClass Enum mapping
itemProperties.hazmatClass hasHazmat null β†’ false
warehouseLocation.zone pickZone Zone mapping

Caching Strategy

Data Cache TTL Invalidation
Item properties 1 hour On ItemUpdatedEvent
Location mappings 15 min On LocationChangedEvent
Availability No cache Real-time query

Error Handling

Error Action Retry
Missing item properties Query REST API Yes (3x)
Invalid dimensions Use defaults, flag for review No
Unknown hazmat class Route to special handling No
Allocation shortage Wait for reallocation event Yes

Anti-Corruption Layer

Process Path maintains an ACL to translate Inventory concepts:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
public class InventoryACL {

    public ShipmentProperties translate(InventoryAllocatedEvent event) {
        List<Allocation> allocations = event.getAllocations();

        return ShipmentProperties.builder()
            .itemCount(allocations.stream()
                .mapToInt(Allocation::getQuantity).sum())
            .totalWeight(allocations.stream()
                .mapToDouble(a -> a.getItemProperties().getWeight()
                    * a.getQuantity()).sum())
            .maxDimension(allocations.stream()
                .flatMap(a -> Stream.of(
                    a.getItemProperties().getDimensions().getLength(),
                    a.getItemProperties().getDimensions().getWidth(),
                    a.getItemProperties().getDimensions().getHeight()))
                .max(Double::compareTo).orElse(0.0))
            .hasHazmat(allocations.stream()
                .anyMatch(a -> a.getItemProperties().getHazmatClass() != null))
            .fragilityLevel(aggregateFragility(allocations))
            .sortabilityClass(aggregateSortability(allocations))
            .build();
    }

    private FragilityLevel aggregateFragility(List<Allocation> allocations) {
        // Most fragile item determines shipment fragility
        return allocations.stream()
            .map(a -> a.getItemProperties().getFragilityLevel())
            .max(FragilityLevel::compareTo)
            .orElse(FragilityLevel.STANDARD);
    }
}

Monitoring

Key Metrics

Alerts