Description
(see relevant discussion: ejizba/func-nodejs-prototype#14 (comment))
Currently, if an orchestrator wants to call an activity function, it would have code like this:
context.df.callActivity('Hello', 'Cairo')
passing in the activity's name as a string. This provides no intellisense and no validation to confirm that the activity name is the same as the registered activity function.
Similarly, suborchestrations are started by specifying the orchestration's name as a string:
context.df.callSubOrchestrator("DeviceProvisioningOrchestration", deviceId, child_id)
This issue is to explore whether the new programming model can provide us an opportunity to improve this callActivity()
and callSubOrchestrator()
experience, and whether such an improvement would be worth the engineering cost.
An example of this would be to have the API to register activities (df.app.activity()
) and orchestrations (df.app.orchestration()
) return some kind of object that can be passed to the callActivity()
/callSubOrchestration()
functions, as such:
const helloActivity = df.app.activity(activityName, { handler: (input: string) => {
return `Hello, ${input}`;
}
});
const orchestrator: OrchestrationHandler = function* (context) {
const outputs = [];
outputs.push(yield context.df.callActivity(helloActivity, 'Tokyo'));
outputs.push(yield context.df.callActivity(helloActivity, 'Seattle'));
outputs.push(yield context.df.callActivity(helloActivity, 'Cairo'));
return outputs;
};
df.app.orchestration('durableOrchestrator1', orchestrator);