Skip to content

Latest commit

 

History

History

expense

Expense Reporting

In this sample, the expense Workflow creates the expense (via an activity that POSTs to localhost:3000/create) and then waits for a Signal to say whether the expense is approved or rejected:

src/workflows.ts

If it's approved, the payment activity is called (which POSTs to localhost:3000/action), and then the expense's state should be COMPLETED in localhost:3000/list.

Running this sample

  1. temporal server start-dev to start Temporal Server.
  2. npm install to install dependencies.
  3. npm run start.watch to start the Worker.
  4. npm run server.watch to start the expense HTTP server.
  5. In another shell, run one of the execute scripts to start a Workflow:
  • npm run workflow-approve should print out Done: { status: 'COMPLETED' }
  • npm run workflow-timeout should print out Done: { status: 'TIMED_OUT' }