This sample workflow demos how to use local activity to execute short/quick operations efficiently.
local_activity_workflow.go shows how to use local activity
local_activity_workflow_test.go shows how to unit-test workflow with local activity
Steps to run this sample:
- You need a cadence service running. See details in cmd/samples/README.md
- Run the following command to start worker
./bin/localactivity -m worker
- Run the following command to trigger a workflow execution. You should see workflowID and runID print out on screen.
./bin/localactivity -m trigger
- Run the following command to send signal "1" to the running workflow. You should see output that indicate 5 local activity has been run to check the conditions and one condition will be true which result in one activity to be scheduled.
./bin/localactivity -m signal -s _1_ -w <workflow ID from step 3>
- Repeat step 4, but with different signal data, for example, send signal like 2_4 to make 2 conditions true.
./bin/localactivity -m signal -s _2_4_ -w <workflow ID from step 3>
- Run the following command this will exit the workflow.
./bin/localactivity -m signal -s exit