Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename child workflow function #644

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/workflow/runtime/WorkflowContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class WorkflowContext {
}

/**
* Deprecated, use callChildWorkflow
* Schedule sub-orchestrator function for execution.
*
* @param orchestrator A reference to the orchestrator function call
Expand All @@ -115,6 +116,26 @@ export default class WorkflowContext {
return this._innerContext.callSubOrchestrator(getFunctionName(orchestrator), input, instanceId);
}

/**
* Schedule child workflow for execution.
*
* @param orchestrator A reference to the orchestrator function call
* @param input The JSON-serializable input value for the orchestrator function.
* @param instanceId A unique ID to use for the sub-orchestration instance. If not provided, a new GUID will be used.
*
* @returns {Task<TOutput>} A Durable Task that completes when the sub-orchestrator function completes.
*/
public callChildWorkflow<TInput, TOutput>(
orchestrator: TWorkflow | string,
input?: TInput,
instanceId?: string,
): Task<TOutput> {
if (typeof orchestrator === "string") {
return this._innerContext.callSubOrchestrator(orchestrator, input, instanceId);
}
return this._innerContext.callSubOrchestrator(getFunctionName(orchestrator), input, instanceId);
}

/**
* Wait for an event to be raised with the name "name"
*
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/workflow/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe("Workflow", () => {

const parentWorkflow: TWorkflow = async function* (ctx: WorkflowContext): any {
// Call sub-orchestration
yield ctx.callSubWorkflow(childWorkflow);
yield ctx.callChildWorkflow(childWorkflow);
};

workflowRuntime
Expand Down
Loading