This sample workflow process an expense request. The key part of this sample is to show how to complete an activity asynchronously.
Sample Description
Create a new expense report.
Wait for the expense report to be approved. This could take an arbitrary amount of time. So the activity's Execute method has to return before it is actually approved. This is done by returning a special error so the framework knows the activity is not completed yet.
When the expense is approved (or rejected), somewhere in the world needs to be notified, and it will need to call WorkflowClient.CompleteActivity() to tell cadence service that that activity is now completed. In this sample case, the dummy server do this job. In real world, you will need to register some listener to the expense system or you will need to have your own pulling agent to check for the expense status periodic.
After the wait activity is completed, it did the payment for the expense. (dummy step in this sample case)
This sample rely on an a dummy expense server to work.