Skip to content

How to coordinate work across Domains

Coordinate Domains in one UseCase, never in an Action. A UseCase orders permitted Domain Actions, Operations, Queries, and Contracts for one workflow. It keeps each Action atomic and leaves Event delivery guarantees, Authorization, and tenant isolation to their owning pages.

Coordinate without a nested workflow

One UseCase may order Orders and Inventory work inside its transaction. It may use a Domain-owned Contract for a stable capability. It must not call another UseCase, call another Service, import a concrete Infrastructure Adapter, or imply distributed atomicity.

Context: cross-Domain workflow shape — One UseCase orders permitted Domain steps through injected capabilities.

php
return DB::transaction(function () use ($data) {
    $order = $createOrder->execute($data);
    $reserveInventory->execute($order);

    return $order;
});

Keep Actions inside their Domain

An Action owns one aggregate Operation, not a cross-Domain orchestration layer. Pass data through the UseCase or an Operation; inject a Domain-owned Contract when the workflow needs an outbound capability. No Action calls an Action in another Domain.

Context is input, not a guarantee

Actor, tenant, and correlation context may enter at an HTTP, CLI, or durable Job boundary and travel as runtime data. A Job restores needed context and authorizes outside HTTP. That establishes an input seam only: PRD 18 owns Authorization design, tenant isolation, Event/Listener delivery, and idempotency Policy.

Transform cross-Domain Action calls

Context: ❌ Prohibited Action orchestration — An Action cannot coordinate another Domain Action.

php
$inventoryAction->execute($order);

Context: ✅ Correct UseCase coordination — The UseCase selects and orders both atomic Domain steps.

php
$createOrder->execute($data);
$reserveInventory->execute($order);

If either step throws, Laravel rolls back the UseCase boundary; no success return follows. The rule is local workflow atomicity, not a distributed transaction or a payment/durable-delivery recipe.