Confirm a purchase order
The example connects a simulated ERP, Getriebe and a simulated supplier. The ERP sends a purchase request. A reviewer approves it in the Worklist. Getriebe submits the purchase order and waits for confirmation or the deadline. Start with the TypeScript workspace.
Run both outcomes
Section titled “Run both outcomes”Install the workspace according to its README and run:
pnpm example:purchase-order-messagesThe demo uses a loopback Effect server and its own SQLite database. It deploys the BPMN and both XSD files, opens approval tasks, and records the order IDs accepted by the supplier adapter.
| Run | What to observe |
|---|---|
PO-4711 |
The supplier’s confirmation is consumed. The message wins, the instance completes, and the Worklist has no follow-up. |
PO-4712 |
The timer wins and the Worklist opens Follow up with supplier. The subsequent confirmation is recorded as late. The follow-up remains open. |
The output includes the instance ID, outgoing message ID, reply receipt ID and winner. The example also repeats the ERP submission with the same message ID and payload and checks that the original start receipt returns.
Approve in the browser
Section titled “Approve in the browser”-
Run
pnpm example:purchase-order-messages --serve. Copy its loopback origin, using it in place ofhttp://127.0.0.1:PORTbelow. -
In another terminal, run
GETRIEBE_API_ORIGIN=http://127.0.0.1:PORT pnpm dev:worklist. Open the URL printed by Vite and sign in asreviewerwith passwordreviewer. -
Submit from a separate terminal.
Terminal window node apps/server/examples/purchase-order/erp.ts http://127.0.0.1:PORT ERP-4711 1250.50 -
Refresh the Worklist if needed. Claim and open Approve purchase request and complete it with
purchaseOrderIdset toPO-4711andsupplierIdset toSUPPLIER-1. Find the accepted order ID in the server terminal. -
Confirm during the ten-second wait window.
Terminal window node apps/server/examples/purchase-order/supplier.ts http://127.0.0.1:PORT PO-4711
Repeat with new request and order IDs. Wait ten seconds and refresh for Follow up with supplier before confirming the second order. The late receipt and its arrival time appear in the authorized instance detail.
Inspect the model
Section titled “Inspect the model”Open purchase-order.bpmn, purchase-request.xsd and
purchase-order-messages.xsd from apps/server/examples/purchase-order/
together in Modeler. Select the start, Send Task or catch to inspect its
typed mappings. The Correlation section on the Send Task connects
the outgoing and reply fields. The Event-Based Gateway exposes the two
possible continuations.
Use the modeling guide to change the model and the server reference for the delivery and receipt API.