Skip to main content

Domain Message Flow

Following ddd-crew Domain Message Flow Modelling. Participants are contexts and actors. Every arrow is a message the code sends or receives, prefixed cmd:, qry: or evt:. Events travel on retailnetwork.<producer>.events; their full types are on Domain Events. Path parameters are written without braces. The network-wide flows are on Domain message flows.

1. Purchase order accepted, labelled and shipped​

Source: internal/application/usecases/orders.go (IssueOnRelease, SubmitAcknowledgement, RequestLabel, SubmitShipmentConfirmation) and submissions.go (ProcessDueSubmissions).

Omitted: the vendor's reconciliation of the shipment transaction (same as steps 9-10); node-performance's own PackageHandedOver input from shipping-and-tracking; the fleet's internal steps behind its ACL (translation, the held order in order-management). SubmissionProcessed also goes out for every other asynchronous write.

2. Purchase order refused, then reassigned​

Source: internal/application/usecases/orders.go (IssueOnRelease, ExpireUnacknowledged) and internal/domain/purchaseorder/commands_ack.go.

Omitted: the second purchase order may go to another vendor, not only to V-WS. If no node can still meet the promise, order-sourcing marks the group UNSOURCEABLE and no second release arrives. An acknowledgement that arrives after ackBy is refused synchronously (scenario 4).

3. Vendor onboarded and a node brought into the network​

3a. Vendor onboarded, node registered​

Source: internal/application/usecases/submissions.go (RegisterVendorNode, execute) and vendors.go (OnboardVendor).

3b. Profile declared, inventory sent​

Source: internal/application/usecases/submissions.go (DeclareNodeProfile, SubmitInventory, execute) and internal/adapters/inbound/kafka/consumers.go.

Omitted: who activates the node (a network-ops planner calls node-topology's ActivateNode; not a message of this context); who creates the listings (network merchandising in offer-availability); the vendor's reconciliation of each transaction. How the vendor learns its nodeId after step 5 of 3a: the processed NODE_REGISTRATION transaction carries it as nodeId in the GET /vendor/transactions/{transactionId} answer (stored as result_node_id).

4. A transaction fails, and a vendor is rate limited​

Source: internal/adapters/inbound/http/ratelimit.go, idempotency.go and internal/application/usecases/submissions.go (process).

Omitted: node-performance also receives the accepted or expired event. A failed transaction is not retried by this context: only a neighbour outage (5xx or timeout) leaves a submission PROCESSING for up to 5 passes. Whether the vendor re-acknowledges is its own choice.