Skip to content

Commit

Permalink
feature: Support for custom checkpointing (#1883)
Browse files Browse the repository at this point in the history
Co-authored-by: Vinayak <vinayaks@amazon.com>
  • Loading branch information
vinayaksood and Vinayak committed Jan 7, 2021
1 parent c752104 commit a34ae26
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions samtranslator/model/eventsources/pull.py
Expand Up @@ -35,6 +35,7 @@ class PullEventSource(ResourceMacro):
"Queues": PropertyType(False, is_type(list)),
"SourceAccessConfigurations": PropertyType(False, is_type(list)),
"TumblingWindowInSeconds": PropertyType(False, is_type(int)),
"FunctionResponseTypes": PropertyType(False, is_type(list)),
}

def get_policy_arn(self):
Expand Down Expand Up @@ -87,6 +88,7 @@ def to_cloudformation(self, **kwargs):
lambda_eventsourcemapping.Queues = self.Queues
lambda_eventsourcemapping.SourceAccessConfigurations = self.SourceAccessConfigurations
lambda_eventsourcemapping.TumblingWindowInSeconds = self.TumblingWindowInSeconds
lambda_eventsourcemapping.FunctionResponseTypes = self.FunctionResponseTypes

destination_config_policy = None
if self.DestinationConfig:
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/lambda_.py
Expand Up @@ -76,6 +76,7 @@ class LambdaEventSourceMapping(Resource):
"Queues": PropertyType(False, is_type(list)),
"SourceAccessConfigurations": PropertyType(False, is_type(list)),
"TumblingWindowInSeconds": PropertyType(False, is_type(int)),
"FunctionResponseTypes": PropertyType(False, is_type(list)),
}

runtime_attrs = {"name": lambda self: ref(self.logical_id)}
Expand Down
Expand Up @@ -53,6 +53,8 @@ Resources:
MaximumRecordAgeInSeconds: 86400
StartingPosition: TRIM_HORIZON
TumblingWindowInSeconds: 60
FunctionResponseTypes:
- ReportBatchItemFailures
DestinationConfig:
OnFailure:
Type: SQS
Expand Down
Expand Up @@ -182,7 +182,8 @@
"ParallelizationFactor": 8,
"MaximumRetryAttempts": 100,
"BisectBatchOnFunctionError": true,
"TumblingWindowInSeconds": 60
"TumblingWindowInSeconds": 60,
"FunctionResponseTypes": ["ReportBatchItemFailures"]
}
},
"MyFunctionForBatchingExample": {
Expand Down Expand Up @@ -239,4 +240,4 @@
}
}
}
}
}
Expand Up @@ -182,7 +182,8 @@
"ParallelizationFactor": 8,
"MaximumRetryAttempts": 100,
"BisectBatchOnFunctionError": true,
"TumblingWindowInSeconds": 60
"TumblingWindowInSeconds": 60,
"FunctionResponseTypes": ["ReportBatchItemFailures"]
}
},
"MyFunctionForBatchingExample": {
Expand Down Expand Up @@ -239,4 +240,4 @@
}
}
}
}
}
Expand Up @@ -182,7 +182,8 @@
"ParallelizationFactor": 8,
"MaximumRetryAttempts": 100,
"BisectBatchOnFunctionError": true,
"TumblingWindowInSeconds": 60
"TumblingWindowInSeconds": 60,
"FunctionResponseTypes": ["ReportBatchItemFailures"]
}
},
"MyFunctionForBatchingExample": {
Expand Down Expand Up @@ -239,4 +240,4 @@
}
}
}
}
}
6 changes: 6 additions & 0 deletions versions/2016-10-31.md
Expand Up @@ -513,6 +513,7 @@ MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be
DestinationConfig | [Destination Config Object](#destination-config-object) | Expired record metadata/retries and exhausted metadata is sent to this destination after they have passed the defined limits.
ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing.
TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations.
FunctionResponseTypes | `list` | Response types enabled for your function.

**NOTE:** `SQSSendMessagePolicy` or `SNSPublishMessagePolicy` needs to be added in `Policies` for publishing messages to the `SQS` or `SNS` resource mentioned in `OnFailure` property

Expand All @@ -536,6 +537,8 @@ Properties:
Type: SQS
Destination: !GetAtt MySqsQueue.Arn
TumblingWindowInSeconds: 0
FunctionResponseTypes:
- ReportBatchItemFailures
```


Expand Down Expand Up @@ -582,6 +585,7 @@ MaximumRecordAgeInSeconds | `integer` | The maximum age of a record that will be
DestinationConfig | [DestinationConfig Object](#destination-config-object) | Expired record metadata/retries and exhausted metadata is sent to this destination after they have passed the defined limits.
ParallelizationFactor | `integer` | Allocates multiple virtual shards, increasing the Lambda invokes by the given factor and speeding up the stream processing.
TumblingWindowInSeconds | `integer` | Tumbling window (non-overlapping time window) duration to perform aggregations.
FunctionResponseTypes | `list` | Response types enabled for your function.

##### Example: DynamoDB event source object

Expand All @@ -602,6 +606,8 @@ Properties:
Type: SQS
Destination: !GetAtt MySqsQueue.Arn
TumblingWindowInSeconds: 0
FunctionResponseTypes
- ReportBatchItemFailures
```

#### SQS
Expand Down

0 comments on commit a34ae26

Please sign in to comment.