我们正在对AWS步骤功能(状态机)实现工作流,该工作流程涉及用户记录的更新,并可能出现问题,以防万一出现问题。状态计算机会分为2个部分:
- PART1-更新
- Part2-回滚路径
在状态计算机采取回滚路径时,该过程需要很长时间。使客户等待这么长时间是无法接受的。但是,在开始回滚之前,可以通知客户。我试图找出一种实现这一目标的方法。
我已经尝试使用 Deficteexecution()。但是,只有在状态机执行后,失败状态才会更改为失败,这又很晚了。
我尝试在可能失败的点(部分和部分之间)插入“ SQS发送消息”步骤(部分和部分之间)。然后从编排函数(我的API端点的处理程序)中对该队列进行轮询。但是,这无法正常工作,因为我可能会并行运行100个请求,而SQS最终将失败。
感谢早期回应。
干杯。
We are implementing a workflow on aws step functions(state machine), that deals with update of user records and possible rollback in case something goes wrong. The state machine does processing in 2 parts:
- Part1 - updating
- Part2 - rollback
When rollback path is taken by the state machine, the process takes very long. Unacceptable to make the client wait this long. Just before starting the rollback however, the client could be informed. I am trying to figure out a way to achieve this.
I have already tried using describeExecution(). But the fail status changes to FAILED only after the state machine is done executing, which is again very late.
I tried inserting an "SQS send message" step at the point(between part1 and part2) where it is likely to fail. And then polling this queue from the orchestration function(handler of my API endpoint). However, this is not going to work as I may have 100s of requests running in parallel and SQS will eventually fail.
Appreciate an early response.
Cheers.
发布评论
评论(1)
首先,我建议您阅读步骤函数中的错误处理: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error andling.html 。
您可以使用后备状态(任务,映射,并行)并通过添加
catch
字段来捕获错误:如果您打算使用API来获取可以使用 getexecutionhistory 。它将返回事件列表,您可以检查返回的事件阵列中的失败。 ie
First I'd recommend you to read up on error handling in step functions: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html .
You could use fallback states (Task, Map, Parallel) and catch the error by adding
Catch
field like so:If you are intending to use API to get the current state of the execution you could use GetExecutionHistory. It will return list of events and you can check the returned array of events for the failures. I.E. taskFailedEventDetails