Task Execution Service Integration

Overview

Attribute Value
Context Task Execution Service
Pattern Customer-Supplier
Direction Outbound (Process Path → Task Execution)
Protocol Apache Kafka + REST API
Topics process-path.routing.events

Integration Summary

Process Path is the supplier that publishes routing decisions, and Task Execution Service is the customer that consumes these events to create and assign tasks to warehouse workers. Task Execution depends on Process Path for work initiation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
┌─────────────────────────┐         ┌─────────────────────────┐
│      PROCESS PATH       │         │   TASK EXECUTION        │
│                         │         │                         │
│  • Path assignment      │  ─────► │  • Task creation        │
│  • SLA priority         │  Event  │  • Worker assignment    │
│  • Rerouting decisions  │         │  • Queue management     │
│                         │         │  • Progress tracking    │
└─────────────────────────┘         └─────────────────────────┘
                                              │
                                              │ Feedback
                                              ▼
                                    ┌─────────────────────────┐
                                    │   Task Completion       │
                                    │   Events (consumed)     │
                                    └─────────────────────────┘

Events Published

ShipmentRoutedToPathEvent

Purpose: Triggers task creation for assigned path

Topic: process-path.routing.events

Consumer Action: Create pick/pack tasks based on path type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "specversion": "1.0",
  "type": "com.paklog.processpath.shipment.routed.v1",
  "source": "/process-path-service",
  "id": "evt-route-123456",
  "time": "2025-01-20T10:00:00.000Z",
  "subject": "SHP-123456",
  "data": {
    "shipmentId": "SHP-123456",
    "orderId": "ORD-789012",
    "assignedPath": "AFE",
    "pathId": "PATH-AFE-01",
    "routingScore": 87.5,
    "shipmentType": "MULTI",
    "itemCount": 3,
    "slaPriority": "GREEN",
    "estimatedCycleTime": "PT15M",
    "carrierCutoffTime": "2025-01-20T16:00:00Z",
    "routedAt": "2025-01-20T10:00:00Z"
  }
}

SLAPriorityEscalatedEvent

Purpose: Update task priority in queue

Consumer Action: Reprioritize existing tasks

1
2
3
4
5
6
7
8
9
10
{
  "type": "com.paklog.processpath.sla.escalated.v1",
  "data": {
    "shipmentId": "SHP-123456",
    "previousPriority": "GREEN",
    "newPriority": "YELLOW",
    "timeToSLACutoff": "PT45M",
    "expeditedRouting": false
  }
}

ShipmentReroutedEvent

Purpose: Update task assignments for rerouted shipment

Consumer Action: Cancel old tasks, create new tasks for new path

1
2
3
4
5
6
7
8
9
{
  "type": "com.paklog.processpath.shipment.rerouted.v1",
  "data": {
    "shipmentId": "SHP-123456",
    "originalPath": "AFE",
    "newPath": "SINGLES",
    "rerouteReason": "BOTTLENECK"
  }
}

Events Consumed

TaskCompletedEvent

Purpose: Track shipment progress through path

Topic: task-execution.tasks.completed

1
2
3
4
5
6
7
8
9
10
11
12
{
  "type": "com.paklog.task.completed.v1",
  "data": {
    "taskId": "TASK-123456",
    "taskType": "PICK",
    "shipmentId": "SHP-123456",
    "workerId": "WORKER-001",
    "completedAt": "2025-01-20T10:15:00.000Z",
    "duration": "PT5M",
    "nextTaskType": "INDUCT"
  }
}

TaskFailedEvent

Purpose: Handle task failures, trigger rerouting if needed

Topic: task-execution.tasks.failed

1
2
3
4
5
6
7
8
9
10
{
  "type": "com.paklog.task.failed.v1",
  "data": {
    "taskId": "TASK-123456",
    "taskType": "PICK",
    "shipmentId": "SHP-123456",
    "failureReason": "ITEM_NOT_FOUND",
    "failedAt": "2025-01-20T10:15:00.000Z"
  }
}

Task Creation by Path Type

Singles Path Tasks

1
2
3
4
5
6
7
8
9
10
ShipmentRoutedToPath(SINGLES)
    │
    ├── Task: PICK
    │   └── Pick item to yellow tote
    │
    ├── Task: TRANSPORT (if robotic)
    │   └── Move tote to pack station
    │
    └── Task: PACK
        └── Pack and send to SLAM

AFE Path Tasks

1
2
3
4
5
6
7
8
9
10
11
12
13
ShipmentRoutedToPath(AFE)
    │
    ├── Task: PICK (per item)
    │   └── Pick item to yellow tote
    │
    ├── Task: INDUCT
    │   └── Transfer item to AFE tray
    │
    ├── Task: REBIN
    │   └── Place item in wall chute
    │
    └── Task: PACK (when complete)
        └── Pack consolidated order

Batch/Flow Path Tasks

1
2
3
4
5
6
7
8
9
10
ShipmentRoutedToPath(BATCH_FLOW)
    │
    ├── Task: BATCH_PICK
    │   └── Pick multiple orders in wave
    │
    ├── Task: PUT_WALL
    │   └── Sort to order slot
    │
    └── Task: PACK (per order)
        └── Pack from wall slot

API Contracts

Query Task Status

Endpoint: GET /api/v1/tasks/shipment/{shipmentId}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "shipmentId": "SHP-123456",
  "currentTasks": [
    {
      "taskId": "TASK-123456",
      "taskType": "REBIN",
      "status": "IN_PROGRESS",
      "assignedWorker": "WORKER-001",
      "startedAt": "2025-01-20T10:10:00Z"
    }
  ],
  "completedTasks": 2,
  "remainingTasks": 1,
  "estimatedCompletion": "2025-01-20T10:20:00Z"
}

Get Path Queue Depth

Endpoint: GET /api/v1/tasks/queue/{pathId}

Response:

1
2
3
4
5
6
7
8
9
10
11
{
  "pathId": "PATH-AFE-01",
  "queueDepth": 45,
  "byPriority": {
    "RED": 2,
    "YELLOW": 8,
    "GREEN": 35
  },
  "oldestTaskAge": "PT12M",
  "avgWaitTime": "PT3M"
}

Priority Mapping

Process Path Priority Task Execution Priority Queue Position
RED 90-100 Top of queue
YELLOW 50-89 Upper half
GREEN 0-49 Normal FIFO

Coordination Points

Task Assignment Feedback

Task Execution provides queue depth information that Process Path uses for load balancing:

1
2
3
4
5
6
7
8
9
{
  "pathId": "PATH-AFE-01",
  "metrics": {
    "queueDepth": 45,
    "avgTaskDuration": "PT5M",
    "activeWorkers": 8,
    "throughputPerHour": 180
  }
}

Capacity Signaling

Process Path queries Task Execution for worker availability:

1
2
3
4
5
6
7
8
Process Path:
  - "Can PATH-AFE-01 handle 50 more shipments?"

Task Execution:
  - "Current capacity: 65% utilized"
  - "8/10 workers active"
  - "Queue depth: 45"
  - "Recommendation: ACCEPT"

Error Handling

Error Process Path Action Task Execution Action
Task timeout Check for bottleneck Reassign task
Worker unavailable Reduce path score Find alternate worker
Path overloaded Route to alternate path Reject new tasks
Task failure Trigger rerouting Report failure

SLA Propagation

When Process Path escalates SLA priority:

  1. Process Path publishes SLAPriorityEscalatedEvent
  2. Task Execution receives event
  3. Task Execution finds all tasks for shipment
  4. Task Execution updates task priority
  5. Tasks move up in queue
  6. Workers see updated priority on devices

Monitoring

Key Metrics

Alerts