[英]How can i call "sendTaskSuccess" that return the token to a waiting state in stepfunction. not using lambda function
I have an external service which is called by a state in aws step function, now from this external service i want to send "sendTaskSuccess" to the particular aws step machine.我有一个外部服务,在 aws 步骤 function 中由 state 调用,现在我想从这个外部服务发送“sendTaskSuccess”到特定的 aws step 机器。 How can i do that.
我怎样才能做到这一点。 I know that we can call "sendSuccessToken" from lambda but want to know how to use "sendSuccessToken" without lambda.
我知道我们可以从 lambda 调用“sendSuccessToken”,但想知道如何在没有 lambda 的情况下使用“sendSuccessToken”。
The state machine ARN is not used.The step in the state machine that await a callback have a taskToken which uniquely identifies a specific task and a specific execution of state machine.未使用 state 机器 ARN。等待回调的 state 机器中的步骤有一个 taskToken,它唯一标识特定任务和 state 机器的特定执行。
The ideal way to do this would be: Step 1: Store the taskToken in a persistent storage before invoking the external service执行此操作的理想方法是:第 1 步:在调用外部服务之前将 taskToken 存储在持久存储中
export const lambdaHandler: ProxyHandler = async (event, context) => {
const evt = JSON.parse(JSON.stringify(event));
const taskToken = evt['token'];
const dbObject =
{
SomeHelpfulInfo: 'set a suitable identifier',
taskToken:taskToken
};
StoreTaskToken(dbObject);
//call external service as per your logic
//
}
Step 2: Read the taskToken from the persistent storage and invoke the step function task success第二步:从持久化存储中读取taskToken,调用步骤function任务成功
import { StepFunctions } from 'aws-sdk';
const stepfunctions = new StepFunctions();
const taskToken = GetTaskTokenFromDb(); //Have your implementation to get taskToken
const params = {
output: '',
taskToken: taskToken
};
let result = await stepfunctions.sendTaskSuccess(params).promise();
console.log('State machine - callback completed..');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.