文章目录
- step-functions
- State machine type
- Standard workflows
- Express workflows
- design skills
- Error handling
- saga Transaction processing
- 控制分布式系统中的并发性
- 收费
作为AWS Serverless无服务器的一个重要一环
使用step-functions方法将 AWS 服务链接在一起
step-functions
https://us-east-2.console.aws.amazon.com/states/home?region=us-east-2#/homepage
功能:
配置工作流,工作流中的每个步骤称为一个状态
任务状态可以调用任何 AWS 服务或 API
State machine type
Standard workflows
异步,仅执行一次workflows,可以运行长达一年
Express workflows
同步,至少执行一次workflows,最多可以运行五分钟
design skills
-
keep all output
-
当需要使用引号,但双引号和单引号都已使用时,请使用``。
-
pass value
另一种典型场景:根据@type选择时,选择中无法识别@符号,那么可以先添加一个Pass状态:
"Pass": {
"Type": "Pass",
"Next": "Choice",
"Parameters": {
"type.$": "$.@type"
},
"ResultPath": "$.pass"
},
"Choice": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.pass.type",
"StringEquals": "ProductOfferingPrice",
"Next": "[API]active productOffering (1)"
},
{
"Variable": "$.pass.type",
"StringEquals": "ProductOfferingPriceRef",
"Next": "[API]patch productOfferingPrice1"
}
],
"Default": "Skip"
}
Error handling
Every api call should include success Output and Error handling ! ! !
- Errors that need to be captured separately, should have a separate error handling
like:ApiGateway.400 ApiGateway.404
saga Transaction processing
- https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/implement-the-serverless-saga-pattern-by-using-aws-step-functions.html
控制分布式系统中的并发性
https://aws.amazon.com/cn/blogs/compute/controlling-concurrency-in-distributed-systems-using-aws-step-functions/
收费
便宜,100万次调用1美元
https://aws.amazon.com/step-functions/pricing/?nc1=h_ls