WES Orchestration Engine Integration

Overview

Attribute Value
Context WES Orchestration Engine
Pattern Partnership
Direction Bidirectional
Protocol Apache Kafka + REST API
Topics wes.orchestration.*, process-path.capacity.*

Integration Summary

WES Orchestration Engine and Process Path have a partnership relationship with bidirectional communication. WES controls workflow orchestration and work release, while Process Path manages routing decisions and capacity management. They collaborate to optimize throughput and prevent bottlenecks.

flowchart LR
    subgraph WES["WES ORCHESTRATION"]
        WE[Workflow Execution]
        WR[Work Release Control]
        CB[Circuit Breaking]
        LD[Load Distribution]
    end

    subgraph PP["PROCESS PATH"]
        PA[Path Assignment]
        CM[Capacity Management]
        LB[Load Balancing]
        BM[Buffer Monitoring]
    end

    WR <-->|Events + API| PA
    CB -->|CircuitBreakerEvent| CM
    CM -->|CapacityChangedEvent| LD
    LB -->|RebalanceEvent| WR

WES-Process Path Coordination Sequence

sequenceDiagram
    participant WES as WES Orchestration
    participant ROUTING as Routing Service
    participant ORCH as Orchestration Service

    rect rgb(240, 248, 255)
        Note over WES,ORCH: Normal Work Release
        WES->>ROUTING: Query capacity (API)
        ROUTING-->>WES: Capacity snapshot
        WES->>ROUTING: WorkReleaseAuthorizedEvent
        ROUTING->>ROUTING: Route shipments
        ROUTING-->>WES: ShipmentRoutedToPathEvent
    end

    rect rgb(255, 240, 240)
        Note over WES,ORCH: Circuit Breaker Pattern
        WES->>ROUTING: CircuitBreakerStateChangedEvent
        Note right of WES: State: OPEN
        ROUTING->>ROUTING: Mark paths degraded
        ROUTING->>ROUTING: Route away from affected
    end

    rect rgb(255, 250, 240)
        Note over WES,ORCH: Surge Detection
        ORCH->>WES: SurgeDetectedEvent
        Note right of ORCH: Level 2 surge
        WES->>WES: Activate surge protocols
        WES->>WES: Notify labor management
    end

Events Published by Process Path

PathCapacityChangedEvent

Purpose: Inform WES of capacity state changes

Topic: process-path.capacity.events

Consumer Action: Adjust work release rate

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "type": "com.paklog.processpath.capacity.changed.v1",
  "data": {
    "pathId": "PATH-AFE-01",
    "pathType": "AFE",
    "previousState": "NORMAL",
    "currentState": "CONSTRAINED",
    "utilizationPercent": 85.5,
    "currentThroughput": 2308,
    "maxThroughput": 2700,
    "activeStations": 8,
    "maxStations": 10,
    "projectedRecoveryTime": "PT20M"
  }
}

WorkloadRebalanceTriggeredEvent

Purpose: Notify WES of rebalancing activity

Topic: process-path.capacity.events

1
2
3
4
5
6
7
8
9
10
11
12
{
  "type": "com.paklog.processpath.workload.rebalance.v1",
  "data": {
    "rebalanceId": "REB-2025-01-20-001",
    "triggerReason": "UTILIZATION_IMBALANCE",
    "affectedPaths": [
      {"pathId": "PATH-AFE-01", "fromUtilization": 95, "targetUtilization": 80},
      {"pathId": "PATH-SINGLES-01", "fromUtilization": 50, "targetUtilization": 65}
    ],
    "estimatedCompletionTime": "PT10M"
  }
}

SurgeDetectedEvent

Purpose: Alert WES to volume surge

Topic: process-path.capacity.events

1
2
3
4
5
6
7
8
9
10
{
  "type": "com.paklog.processpath.surge.detected.v1",
  "data": {
    "surgeLevel": "LEVEL_2",
    "volumePercentOfForecast": 135,
    "affectedPaths": ["AFE", "SINGLES"],
    "recommendedActions": ["ACTIVATE_ADDITIONAL_STATIONS", "EXTEND_SHIFTS"],
    "estimatedDuration": "PT2H"
  }
}

Events Consumed from WES

WorkReleaseAuthorizedEvent

Purpose: Signal capacity for batch work release

Topic: wes.orchestration.work.released

Action: Process batch of shipments for routing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "type": "com.paklog.wes.work.release.v1",
  "data": {
    "batchId": "BATCH-2025-01-20-001",
    "shipmentIds": ["SHP-001", "SHP-002", "SHP-003"],
    "releaseStrategy": "WAVELESS",
    "capacitySnapshot": {
      "singlesUtilization": 65,
      "afeUtilization": 78,
      "batchFlowUtilization": 45
    },
    "laborAvailability": {
      "pickers": 25,
      "packers": 18,
      "rebinners": 12
    }
  }
}

CircuitBreakerStateChangedEvent

Purpose: Adjust routing based on service health

Topic: wes.orchestration.circuit.state

Action: Modify path availability

1
2
3
4
5
6
7
8
9
10
11
{
  "type": "com.paklog.wes.circuit.state.v1",
  "data": {
    "serviceName": "pack-ship-service",
    "previousState": "CLOSED",
    "currentState": "OPEN",
    "failureRate": 45.5,
    "impactedPaths": ["SINGLES", "AFE"],
    "estimatedRecoveryTime": "PT5M"
  }
}

LoadBalanceRequestEvent

Purpose: Request from WES to rebalance

Topic: wes.orchestration.load.request

1
2
3
4
5
6
7
8
9
10
{
  "type": "com.paklog.wes.load.balance.request.v1",
  "data": {
    "requestId": "LB-REQ-001",
    "reason": "SERVICE_DEGRADATION",
    "affectedService": "afe-sorter",
    "requestedAction": "REDUCE_AFE_LOAD",
    "targetReduction": 20
  }
}

API Integration

Query Capacity (Process Path → WES)

Endpoint: GET /api/v1/orchestration/capacity

WES queries Process Path for routing decisions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "warehouseId": "WH-001",
  "paths": [
    {
      "pathId": "PATH-SINGLES-01",
      "pathType": "SINGLES",
      "utilizationPercent": 65,
      "capacityState": "NORMAL",
      "canAcceptWork": true,
      "recommendedBatchSize": 50
    },
    {
      "pathId": "PATH-AFE-01",
      "pathType": "AFE",
      "utilizationPercent": 85,
      "capacityState": "CONSTRAINED",
      "canAcceptWork": true,
      "recommendedBatchSize": 20
    }
  ]
}

Request Work Release Authorization

Endpoint: POST /api/v1/routing/authorize-release

Process Path authorizes work release based on capacity:

Request:

1
2
3
4
5
{
  "batchId": "BATCH-001",
  "proposedShipments": 100,
  "targetPaths": ["SINGLES", "AFE"]
}

Response:

1
2
3
4
5
6
7
8
9
10
{
  "authorized": true,
  "authorizedCount": 80,
  "distribution": {
    "SINGLES": 50,
    "AFE": 30
  },
  "holdReason": "AFE_CONSTRAINED",
  "retryAfter": null
}

Coordination Patterns

Waveless Work Release

sequenceDiagram
    participant WES as WES Orchestration
    participant PP as Process Path

    loop Continuous
        WES->>WES: Detect incoming volume
        WES->>PP: Query capacity (API)
        PP-->>WES: Available capacity per path
        WES->>WES: Calculate optimal batch
        WES->>PP: WorkReleaseAuthorizedEvent
        PP->>PP: Route shipments
        PP-->>WES: ShipmentRoutedToPathEvent
    end

Circuit Breaker Integration

sequenceDiagram
    participant WES as WES Orchestration
    participant PP as Process Path
    participant SVC as Downstream Service

    WES->>SVC: Request
    SVC--xWES: Failure
    WES->>WES: Open circuit breaker
    WES->>PP: CircuitBreakerStateChangedEvent (OPEN)
    PP->>PP: Mark affected paths degraded
    PP->>PP: Route away from affected

    loop Health Check
        WES->>SVC: Test request
        alt Healthy
            SVC-->>WES: Success
            WES->>PP: CircuitBreakerStateChangedEvent (CLOSED)
            PP->>PP: Restore normal routing
        end
    end

Surge Handling Coordination

sequenceDiagram
    participant PP as Process Path
    participant WES as WES Orchestration
    participant LABOR as Labor Management

    PP->>PP: Detect volume > 120%
    PP->>WES: SurgeDetectedEvent (LEVEL_2)

    WES->>WES: Activate surge protocols
    WES->>LABOR: Request additional staff
    WES->>WES: Activate reserve stations

    WES->>PP: Increase work release
    PP->>PP: Monitor capacity

    Note over PP,WES: Surge subsides
    PP->>WES: SurgeRecoveryEvent
    WES->>WES: Return to normal ops

Capacity Contract

Process Path guarantees to WES:

Metric Guarantee
Capacity query response < 100ms
Authorization decision < 500ms
Capacity event publish < 1s after change
Rebalancing completion < 15 min

WES guarantees to Process Path:

Metric Guarantee
Circuit breaker notification < 1s
Work release respect of limits 100% compliance
Surge response activation < 5 min

Load Balancing Protocol

Normal Operations

1
2
3
4
5
6
WES: "Release 100 shipments"
Process Path: "Capacity available"
  - SINGLES: 50 (65% util)
  - AFE: 30 (78% util)
  - BATCH: 20 (45% util)
WES: Releases 100 shipments distributed

Constrained Operations

1
2
3
4
5
6
7
WES: "Release 100 shipments"
Process Path: "Limited capacity"
  - SINGLES: 30 (85% util → CONSTRAINED)
  - AFE: 10 (92% util → CONSTRAINED)
  - BATCH: 20 (45% util → NORMAL)
  - Hold: 40 (retry in 10 min)
WES: Releases 60 shipments, queues 40

Critical Operations

1
2
3
4
5
6
7
8
WES: "Release 100 shipments"
Process Path: "Critical capacity"
  - SINGLES: 0 (98% util → CRITICAL)
  - AFE: 0 (99% util → CRITICAL)
  - BATCH: 10 (85% util → CONSTRAINED)
  - Hold: 90 (retry in 20 min)
WES: Releases 10 to BATCH, holds 90
WES: Triggers surge protocol

Error Handling

Scenario Process Path Action WES Action
WES unreachable Queue capacity updates Use cached capacity
Process Path unreachable N/A Reduce work release
Capacity mismatch Publish correction event Adjust release rate
Rebalancing failure Publish failure event Maintain current distribution

Monitoring

Shared Metrics

Health Checks

WES and Process Path perform mutual health checks:

1
2
Process Path → WES: /health (every 10s)
WES → Process Path: /health (every 10s)

Alerts