我正在使用无服务器框架和serverless-step-functions
插件。我想检查步进功能工作流程中的任何错误,并将此错误发送到sqs队列。
目前,我想将所有输入作为消息传递给queue(MessageBody: $
)。但是,如果我从队列中获取数据,则消息为$
(美元符号),而不是实际输入。如何将上一步中的错误消息发送到队列中?
States:
state1:
Type: Task
Resource:
Fn::GetAtt: [function1, Arn]
Next: state2
Catch:
- ErrorEquals: [States.ALL]
Next: sendErrorToDLQ
ResultPath: $.error
state2:
Type: Task
Resource:
Fn::GetAtt: [function2, Arn]
Next: done
Catch:
- ErrorEquals: [ States.ALL ]
Next: sendErrorToDLQ
ResultPath: $.error
sendErrorToDLQ:
Type: Task
Resource: arn:aws:states:::sqs:sendMessage
Parameters:
QueueUrl:
Ref: ServiceDeadLetterQueue
MessageBody: $ # <== how to pass input to sqs message
Next: fail
fail:
Type: Fail
done:
Type: Succeed
连接SNS时我有相同的感觉。根据AWS文档,我们必须遵循以下结构来发送参数
"MessageBody.$": "$"
参考:https : //docs.aws.amazon.com/step-functions/latest/dg/connect-sqs.html
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句