Skip to main content

Integration

labor-performance takes data in only by consuming Kafka and through its own inbound REST API. Other contexts read from it through its topics, its REST and reports APIs, and its MCP server. It makes no outbound REST or MCP call to any sibling. The fitness test TestNoSiblingContextOutboundCalls forbids an outbound HTTP client in internal/adapters/outbound. For the DDD relationship analysis, see the Context map.

Source: internal/adapters/kafka/cloudevents/cloudevents.go, internal/adapters/inbound/*, and the consumer code in the sibling repos cited below.

Upstream​

UpstreamProtocolContractHow it is consumedFailure behaviour
fulfillment-executionKafka, CloudEvents 1.0 structuredTopic warehouse.fulfillment.events, type com.warehouse.wes.fulfillment-execution.task.TaskCompleted. data fields used: task_id, associate_id, duration_seconds, task_type, plus the optional handling_unit and weight_g (ADR 0035; not published by fulfillment-execution today, absent means scored as before). station_id and work_unit_id are decoded but not used. The completion instant is the CloudEvents time, and the dedupe key is the CloudEvents id.cmd/labor, group KAFKA_CONSUMER_GROUP (default labor-performance). It is a Conformist to this shared fan-out topic. Every other type on the topic is ignored.Invalid CloudEvent: straight to warehouse.fulfillment.events.dlq and committed. Handler error: 3 attempts, then DLQ and commit. DLQ or commit failure: the consumer stops, the pod restarts and the message is redelivered. Missing associate_id, task_type or duration degrade to unattributed, unclassified or unscored. They are never rejected.
Operators (labor_mfe remote, curl)REST, apis/openapi.yamlPOST /standards with Idempotency-Keycmd/laborRFC 7807 errors (Troubleshooting).

Absent upstreams, on purpose:

  • No standard comes from another context. Industrial engineering defines standards through POST /standards. An optional travelComponentSeconds can be supplied by the caller, for example from facility-layout's travel estimate, but this service never fetches it (ADR 0015). The same holds for the optional handling unit and heavy-case team lift of a standard (ADR 0035): declared through POST /standards, never read from product-master or any other context. The optional siteCode of a standard (ADR 0038) is likewise declared by the caller and never resolved or validated against facility-layout.
  • No dependency on workforce-management (shifts, paths) or on process-path-management. The fleet bans REST and MCP calls from this context to siblings.

Downstream​

DownstreamProtocolContractWhat it does with itFailure behaviour
workforce-managementKafkaTopic warehouse.labor-performance.events, type com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded, dataschema urn:warehouse:labor-performance:events:TaskPerformanceRecorded:v1, key AssociateId (ADR 0013)Builds a measured-rate and idle-share cache (internal/adapters/outbound/laborperformancecache in that repo, group prefix workforce-management-labor-performance-cache). It ignores the other types on the topic.Fed only when EVENT_PUBLISHER=kafka. With the outbox, events wait in outbox_events while the broker is down and are delivered later at least once, with a stable CloudEvents id.
warehouse-planningKafkaTopic warehouse.labor-performance.events, types com.warehouse.wes.labor-performance.standard.LaborStandardDefined and com.warehouse.wes.labor-performance.standard.LaborStandardRevised, dataschema urn:warehouse:labor-performance:events:<EventName>:v1, key TaskType, subject the new StandardId (ADR 0038)Keeps a local copy of the standards (its ADR 0022), per site when site_code is present.Same outbox guarantees. Ordering holds per task type, so a task type's revisions arrive in order.
labor-projector (this repo)KafkaTopic warehouse.labor-performance.analytics: com.warehouse.wes.labor-performance.standard.LaborStandardDefined, com.warehouse.wes.labor-performance.standard.LaborStandardRevised, com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded, with dataschema urn:warehouse:labor-performance:analytics:<EventName>:v1 and key TaskTypeRollup in the analytical database (ADR 0007).Same outbox guarantees. The projector retries transient errors forever and skips bad input.
warehouse-ops-agentMCP (Streamable HTTP)get_associate_scorecard, get_task_type_performance, get_labor_standard, get_task_type_utilization (MCP tools)Its FlowBalanceAdvisory overlays get_task_type_utilization on rebalance recommendations. It is configured on its side through LABOR_PERFORMANCE_MCP_ENDPOINT.On the agent's side, a missing or unreachable endpoint skips the utilization overlay. Nothing on this side depends on it.
warehouse-ops-agentREST (reports)GET /reports/performance, GET /reports/performance/freshness (apis/openapi-reports.yaml)Console report section "Labor Performance (Efficiency %)", configured through LABOR_PERFORMANCE_REPORTS_REST_URL on its side.The agent degrades only that section ("labor-performance reports not available").
warehouse-consoleModule Federation and RESTRemote labor_mfe/App mounted at /labor, OLTP API base /api/labor-performance (Kong). The context-reports page reads /reports/performance and /reports/performance/freshness.Operator screens and the WES dashboard report card.CORS through CORS_ALLOWED_ORIGINS. Each card shows its freshness lag.

e2e-tests also checks this context's topics in its warehouse-day verification. That is a test harness, not a runtime consumer.

Event payloads​

TaskPerformanceRecorded (both topics, snake_case data):

FieldTypeNotes
task_idstring
associate_idstringEmpty for robot stations. The CloudEvents subject falls back to task_id in that case.
task_typestringPICK, PACK, SLAM, or "" when unclassified
efficiency_pctnumber or nullnull = unscorable, never 0
actual_secondsinteger
idle_seconds_beforeinteger or nullIdle gap before this task. null = not observed.
completed_atRFC 3339Business time. Feeds the hour bucket.
handling_unitEACH, CASE or PALLETAdditive (ADR 0035). Present only when the completion carried a handling unit; omitted otherwise.
team_liftbooleanAdditive. Present only with handling_unit: true when the CASE team-lift time scored the completion.

LaborStandardDefined / LaborStandardRevised (both topics since ADR 0038, the same data on each) carry standard_id, task_type, expected_seconds, effective_from, an optional travel_component_seconds, the additive handling_unit, team_lift_threshold_g and team_lift_expected_seconds (only when declared, ADR 0035), the additive site_code (only for a site-scoped standard, ADR 0038), and on revisions previous_expected_seconds. The subject is the StandardId. Field definitions are in Domain events and apis/asyncapi.yaml.

Compatibility rules​

  • Every message is CloudEvents 1.0 in structured mode, with header content-type: application/cloudevents+json; charset=UTF-8 (ADR 0021).
  • Consumers must dedupe on the CloudEvents id. Outbox delivery is at-least-once and a resend keeps the same id.
  • Payload changes are additive. idle_seconds_before was added without a version bump, and workforce-management's consumer tolerates unknown fields. A breaking change needs a new dataschema version.
  • Ordering holds only per partition key: AssociateId for TaskPerformanceRecorded on .events, TaskType for the standard events on .events and for everything on .analytics.