是否可以从 AWS JavaScript v3 SDK 调用 AWS Step Functions?
Is it possible to call AWS Step Functions from AWS JavaScript v3 SDK?
我 8 月份在论坛上发帖 this question,请求 V3 JavaScript API 何时添加对 AWS Step Functions 的支持,因为它在 V2 SDK 中。我还没有听到有关该线程的任何消息。
是否有人提供了替代解决方案,我可以从 V2 SDK 中迁移出来?
目前支持从 AWS V3 Javascript sdk 调用 Step Functions。
对于标准调用,我们可以使用 StartExecutionCommand
, or we can use StartSyncExecutionCommand
同步快速步骤函数。
这是使用 Node.js 的标准调用示例:
const { SFNClient, StartExecutionCommand } = require("@aws-sdk/client-sfn");
const client = new SFNClient({ region: 'us-east-1' });
async function invoke(executionName, arn, input) {
const command = new StartExecutionCommand({
input: JSON.stringify(input),
name: executionName,
stateMachineArn: arn
});
return await client.send(command);
}
(async () => {
console.log(await invoke('execution123', '' +
'arn:aws:states:us-east-1:XXXXXXXXX:stateMachine:HelloWorld',
{fistName: 'test'}));
})();
我 8 月份在论坛上发帖 this question,请求 V3 JavaScript API 何时添加对 AWS Step Functions 的支持,因为它在 V2 SDK 中。我还没有听到有关该线程的任何消息。
是否有人提供了替代解决方案,我可以从 V2 SDK 中迁移出来?
目前支持从 AWS V3 Javascript sdk 调用 Step Functions。
对于标准调用,我们可以使用 StartExecutionCommand
, or we can use StartSyncExecutionCommand
同步快速步骤函数。
这是使用 Node.js 的标准调用示例:
const { SFNClient, StartExecutionCommand } = require("@aws-sdk/client-sfn");
const client = new SFNClient({ region: 'us-east-1' });
async function invoke(executionName, arn, input) {
const command = new StartExecutionCommand({
input: JSON.stringify(input),
name: executionName,
stateMachineArn: arn
});
return await client.send(command);
}
(async () => {
console.log(await invoke('execution123', '' +
'arn:aws:states:us-east-1:XXXXXXXXX:stateMachine:HelloWorld',
{fistName: 'test'}));
})();