![](/img/trans.png)
[英]How to capture output of a parallel state machine in AWS Step function
[英]How reference AWS step function parallel task output?
我在包含兩個分支的 step 函數中有一個並行任務。 輸入是:
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
}
每個分支都返回一個 json 結果,如下所示
分支 1(我使用了“OutputPath”:“$”):
{
"requestType": "GrantAccess",
"DBUser": "exists",
"ADUser": "exists"
}
分支 2(我使用了“ResultPath”:“$.approvalStatus”):
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
"approvalStatus": "Approved"
}
當兩個分支都完成時,並行任務的輸出返回:
[
{
"requestType": "GrantAccess",
"DBUser": "exists",
"ADUser": "exists"
},
{
"database": "test",
"userName": "tester",
"userID": "test123",
"adGroup": "testADGroup",
"dbGroup": "ReadGroup"
"approvalStatus": "Approved"
}
]
下一個任務是一個選擇,
"Choices": [
{
"Variable": "$.input[1].approvalStatus",
"StringEquals": "Approved",
"Next": "ProcessRequest"
},
{
"Variable": "$.input[1].approvalStatus",
"StringEquals": "Declined",
"Next": "SendDeclineNotification"
}
]
它不斷給我以下錯誤:
"cause": "An error occurred while executing the state 'CheckApprovalStatus' (entered at the event id #16). Invalid path '$.input[1].approvalStatus': The choice state's condition path references an invalid value."
所以這里是我的問題,
1)我應該如何在選擇任務中引用它來獲得approvalStatus
值?
2)無論如何我可以讓並行任務以json格式而不是數組返回?
提前致謝
如果您不想更改 ResultPath,我認為您應該使用"$[1].approvalStatus"
之類的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.