Order workflow events AsyncAPI ยท v1.0.0
The thin events that drive an order from placed to paid. Each event names a workflow and the step to run now; the worker reads everything else from the orchestrator database, runs the step, then publishes the event of the next one. The storefront API publishes the first event when an order is placed. One durable RabbitMQ queue carries them all, consumed one at a time and acknowledged once handled, so a worker that dies mid-step gets the event again on restart.
Owned by checkout-squad. Contract: contracts/order-workflow-asyncapi.yaml.
Built from the AsyncAPI contract: who sends and who receives each event on which queue, and each payload field. The Recorded examples tool shows the events the stack really published.
Servers
- amqp://localhost:5672
- The RabbitMQ of mise run up, management UI on http://localhost:15672.
Channels
- order-workflow
- Durable queue, default exchange, routing key order-workflow.
Operations
| Action | Operation | Channel | Messages |
|---|---|---|---|
| send | Start the workflow of a placed order The storefront API publishes the first step once the order is written as pending. |
order-workflow | reserve_stock |
| send | Publish the next step The order worker publishes the following step once a step succeeded. |
order-workflow | issue_invoice, capture_payment |
| receive | Run a step The order worker runs the step an event names, then acknowledges it. |
order-workflow | reserve_stock, issue_invoice, capture_payment |
Reserve stock reserve_stock
Take the ordered quantity from the stock, or cancel the order when there is not enough.
| Field | Type | Required | Allowed values | Description |
|---|---|---|---|---|
| workflow_id | string (uuid) | yes | The workflow, a row of orchestrator.workflows. | |
| type | string | yes | reserve_stock, issue_invoice, capture_payment | The step to run now. |
Example: placed
{
"workflow_id": "6f1d2c3b-4a5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "reserve_stock"
}
Issue invoice issue_invoice
Write the invoice of the order, numbered INV-<year>-<order id>.
| Field | Type | Required | Allowed values | Description |
|---|---|---|---|---|
| workflow_id | string (uuid) | yes | The workflow, a row of orchestrator.workflows. | |
| type | string | yes | reserve_stock, issue_invoice, capture_payment | The step to run now. |
Example: stock reserved
{
"workflow_id": "6f1d2c3b-4a5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "issue_invoice"
}
Capture payment capture_payment
Record the payment of the invoice, which marks the order as paid.
| Field | Type | Required | Allowed values | Description |
|---|---|---|---|---|
| workflow_id | string (uuid) | yes | The workflow, a row of orchestrator.workflows. | |
| type | string | yes | reserve_stock, issue_invoice, capture_payment | The step to run now. |
Example: invoice issued
{
"workflow_id": "6f1d2c3b-4a5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "capture_payment"
}