Order Management Integration
Overview
| Attribute |
Value |
| Context |
Order Management |
| Pattern |
Published Language |
| Direction |
Inbound (Order Management → Process Path) |
| Protocol |
Apache Kafka |
| Topic |
order-management.orders.released |
Integration Summary
Order Management is the primary upstream context that releases orders to Process Path for fulfillment. When an order is ready for warehouse processing, Order Management publishes an event containing order details, SLA requirements, and shipment properties.
flowchart LR
subgraph OM["ORDER MANAGEMENT"]
V[Order Validation]
P[Payment Auth]
I[Inventory Reserve]
S[SLA Calculation]
end
subgraph PP["PROCESS PATH"]
PS[Path Selection]
SP[SLA Prioritization]
WB[Workload Balancing]
end
V --> P --> I --> S
S -->|OrderReleasedEvent| PS
PS --> SP --> WB
Order-to-Routing Sequence
sequenceDiagram
participant OM as Order Management
participant INV as Inventory Service
participant ROUTING as Routing Service
participant ORCH as Orchestration
OM->>OM: Validate order & payment
OM->>INV: Reserve inventory
INV-->>OM: Allocation confirmed
OM->>ROUTING: OrderReleasedToWarehouseEvent
Note over ROUTING: Calculate SLA priority<br/>based on cutoff time
ROUTING->>ORCH: Query capacity state
ORCH-->>ROUTING: Capacity snapshot
ROUTING->>ROUTING: Execute path assignment
alt Path found
ROUTING-->>OM: ShipmentRoutedToPathEvent
else No eligible path
ROUTING-->>OM: PathAssignmentFailedEvent
Note over ROUTING: Schedule retry
end
Events Consumed
OrderReleasedToWarehouseEvent
Purpose: Initiates path selection for a new shipment
Topic: order-management.orders.released
Trigger: Order passes all validation and inventory is allocated
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
| {
"specversion": "1.0",
"type": "com.paklog.order.released.v1",
"source": "/order-management-service",
"id": "evt-order-123456",
"time": "2025-01-20T09:55:00.000Z",
"subject": "ORD-789012",
"data": {
"orderId": "ORD-789012",
"shipmentId": "SHP-123456",
"orderType": "STANDARD",
"customerTier": "PRIME",
"slaCutoffTime": "2025-01-20T16:00:00Z",
"promisedDeliveryDate": "2025-01-21",
"lineItems": [
{
"lineItemId": "LI-001",
"sku": "SKU-WIDGET-001",
"quantity": 2,
"locationHint": "ZONE-A"
}
],
"shipmentProperties": {
"totalWeight": 3.5,
"estimatedDimensions": {
"length": 12,
"width": 8,
"height": 6
},
"hasHazmat": false,
"requiresGiftWrap": false,
"hasFragileItems": true,
"requiresSignature": false
},
"carrierPreference": "UPS_GROUND",
"releasedAt": "2025-01-20T09:55:00Z"
}
}
|
OrderCancelledEvent
Purpose: Cancel routing and release buffer reservations
Topic: order-management.orders.cancelled
1
2
3
4
5
6
7
8
9
| {
"type": "com.paklog.order.cancelled.v1",
"data": {
"orderId": "ORD-789012",
"shipmentId": "SHP-123456",
"cancellationReason": "CUSTOMER_REQUEST",
"cancelledAt": "2025-01-20T10:30:00Z"
}
}
|
OrderModifiedEvent
Purpose: Update routing if order properties change
Topic: order-management.orders.modified
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| {
"type": "com.paklog.order.modified.v1",
"data": {
"orderId": "ORD-789012",
"shipmentId": "SHP-123456",
"modifications": [
{
"field": "carrierPreference",
"oldValue": "UPS_GROUND",
"newValue": "FEDEX_EXPRESS"
}
],
"newSlaCutoffTime": "2025-01-20T14:00:00Z",
"modifiedAt": "2025-01-20T10:00:00Z"
}
}
|
Processing Logic
On OrderReleasedToWarehouseEvent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| 1. Validate event payload
2. Extract shipment properties
3. Calculate SLA priority based on cutoff time:
- > 60 min → GREEN
- 30-60 min → YELLOW
- < 30 min → RED
4. Determine order composition:
- itemCount = 1 → SINGLE
- itemCount > 1 → MULTI
5. Query current path capacity
6. Execute path assignment algorithm
7. Publish ShipmentRoutedToPathEvent
8. If no eligible path:
- Publish PathAssignmentFailedEvent
- Schedule retry based on recommendation
|
On OrderCancelledEvent
1
2
3
4
5
6
7
8
| 1. Lookup current path assignment
2. If shipment in queue (not started):
- Remove from queue
- Release any buffer reservations
3. If shipment in progress:
- Flag for removal at next decision point
- Do not interrupt physical flow
4. Update routing records
|
Data Mapping
| Order Management Field |
Process Path Field |
Transformation |
shipmentId |
shipmentId |
Direct mapping |
orderType |
- |
Used for priority override |
slaCutoffTime |
carrierCutoffTime |
Direct mapping |
lineItems.length |
itemCount |
Count |
shipmentProperties.totalWeight |
totalWeight |
Direct mapping |
shipmentProperties.hasHazmat |
hasHazmat |
Direct mapping |
shipmentProperties.requiresGiftWrap |
requiresGiftWrap |
Direct mapping |
shipmentProperties.hasFragileItems |
fragilityLevel |
Map to enum |
customerTier |
priorityOverride |
PRIME → boost priority |
Error Handling
| Error |
Action |
Retry |
| Invalid event payload |
Log error, skip |
No |
| Missing shipment properties |
Request from Order Mgmt |
Yes (3x) |
| Path assignment timeout |
Retry with backoff |
Yes (5x) |
| All paths unavailable |
Queue for retry |
Yes (indefinite) |
SLA Requirements
| Metric |
Target |
Alert Threshold |
| Event processing latency |
< 500ms |
> 1s |
| Path assignment success |
> 99% |
< 98% |
| End-to-end (order → assignment) |
< 2s |
> 5s |
Monitoring
Key Metrics
process_path_orders_received_total - Orders received from Order Mgmt
process_path_orders_assigned_total - Successfully assigned
process_path_orders_failed_total - Assignment failures
process_path_order_processing_duration_seconds - Processing time
Alerts
- Order processing backlog > 100
- Assignment failure rate > 2%
- Processing latency p99 > 2s