我的编排程序接收一个有效载荷,有效载荷中包含需要传递到活动函数的指令和其他数据集。
如何将多个参数传递给活动函数?还是必须将所有数据混合在一起?
def orchestrator_function(context: df.DurableOrchestrationContext):
# User defined configuration
instructions: str = context.get_input()
task_batch = yield context.call_activity("get_tasks", None)
# Need to pass in instructions too
parallel_tasks = [context.call_activity("perform_task", task) for task in task_batch]
results = yield context.task_all(parallel_tasks)
return results
perform_task
活动需要来自task_batch
和用户输入instructions
的两个项目。
我在我的function.json
中做了什么吗?
解决方法不是很理想,但是我可以将多个参数作为单个元组传递。
something = yield context.call_activity("activity", ("param_1", "param_2"))
然后,我只需要在活动中引用参数的正确索引。
value = payload["value_1"]
并且payload作为参数传递给活动。 - Ari