问题
I have to call a long running workflow from another workflow asynchronously. Is there a way to do that in powershell?
workflow CalledWorkflow
{
Start-Sleep -s 100;
}
workflow CallingWorkflow
{
CalledWorkflow
"CalledWorkFlow Invoked"
}
Now when i call
CallingWorkflow
I need the callingworkflow to immediately return printing "CalledWorkflow Invoked" so that i can start continue my work while the calledworkflow is running in backgroud.
回答1:
What environment are you running the workflows in? In Azure Automation, you can accomplish this by starting a new job from within CallingWorkflow:
workflow CallingWorkFlow
{
Start-AzureAutomationRunbook -Name CalledWorkflow -Parameters ...
"CalledWorkFlow Invoked"
}
(Or Start-AzureRMAutomationRunbook for the RM version of the command).
I imagine you can do something similar in SMA, etc.
来源:https://stackoverflow.com/questions/31103544/calling-workflow-from-another-workflow-as-a-job-in-powershell