Skip to content

Commit bddf55b

Browse files
authored
Merge pull request #493 from hjgraca/release1.8.0-example-updates
chore: Update Batch Processing examples. Update all dependencies
2 parents 87cb4d0 + 82f8b40 commit bddf55b

File tree

12 files changed

+82
-27
lines changed

12 files changed

+82
-27
lines changed

examples/BatchProcessing/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ You will need the following for local testing.
3333
To build and deploy your application for the first time, run the following in your shell. Make sure the `template.yaml` file is in your current directory:
3434

3535
```bash
36-
cd deploy/sqs
3736
sam build
3837
sam deploy --guided
3938
```

examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
<ItemGroup>
88
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
99
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
10-
</ItemGroup>
11-
<ItemGroup>
12-
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.BatchProcessing\AWS.Lambda.Powertools.BatchProcessing.csproj" />
13-
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj" />
14-
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Logging\AWS.Lambda.Powertools.Logging.csproj" />
10+
<PackageReference Include="AWS.Lambda.Powertools.BatchProcessing" Version="0.0.1-preview" />
11+
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.3.2" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
1513
</ItemGroup>
1614
</Project>

examples/BatchProcessing/template-docker.yaml

Whitespace-only changes.

examples/BatchProcessing/template.yaml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Resources:
111111
FunctionResponseTypes:
112112
- ReportBatchItemFailures
113113

114+
# --------------
115+
# Batch Processing for DynamoDb
116+
114117
SampleDynamoDBTable:
115118
Type: AWS::DynamoDB::Table
116119
Properties:
@@ -125,8 +128,41 @@ Resources:
125128
StreamSpecification:
126129
StreamViewType: NEW_AND_OLD_IMAGES
127130

131+
DemoDynamoDBStreamProcessorFunction:
132+
Type: AWS::Serverless::Function
133+
Properties:
134+
FunctionName: powertools-dotnet-sample-batch-processor-dynamodb
135+
CodeUri: ./src/HelloWorld/
136+
Handler: HelloWorld::HelloWorld.Function::DynamoDbStreamHandlerUsingAttribute
137+
Policies: AWSLambdaDynamoDBExecutionRole
138+
Events:
139+
Stream:
140+
Type: DynamoDB
141+
Properties:
142+
Stream: !GetAtt SampleDynamoDBTable.StreamArn
143+
BatchSize: 100
144+
StartingPosition: TRIM_HORIZON
145+
FunctionResponseTypes:
146+
- ReportBatchItemFailures
147+
128148
# --------------
129149
# Batch Processing for Kinesis Data Streams
150+
151+
DemoKinesisStream:
152+
Type: AWS::Kinesis::Stream
153+
Properties:
154+
ShardCount: 1
155+
StreamEncryption:
156+
EncryptionType: KMS
157+
KeyId: !Ref CustomerKey
158+
159+
StreamConsumer:
160+
Type: "AWS::Kinesis::StreamConsumer"
161+
Properties:
162+
StreamARN: !GetAtt DemoKinesisStream.Arn
163+
ConsumerName: KinesisBatchHandlerConsumer
164+
165+
130166
SampleKinesisEventBatchProcessorFunction:
131167
Type: AWS::Serverless::Function
132168
Properties:
@@ -135,15 +171,13 @@ Resources:
135171
CodeUri: ./src/HelloWorld/
136172
Handler: HelloWorld::HelloWorld.Function::KinesisEventHandlerUsingAttribute
137173
MemorySize: 256
138-
# ReservedConcurrentExecutions: 1
139-
Policies:
140-
- AWSLambdaBasicExecutionRole
141-
- KinesisStreamReadPolicy:
142-
StreamName: !Ref SampleKinesisDataStream
143-
Environment:
144-
Variables:
145-
POWERTOOLS_BATCH_PROCESSING_ERROR_HANDLING_POLICY: DeriveFromEvent
146-
POWERTOOLS_BATCH_PROCESSING_MAX_DEGREE_OF_PARALLELISM: 1
174+
Events:
175+
Kinesis:
176+
Type: Kinesis
177+
Properties:
178+
Stream: !GetAtt StreamConsumer.ConsumerARN
179+
StartingPosition: LATEST
180+
BatchSize: 2
147181

148182
Outputs:
149183
DemoSqsQueue:
@@ -155,6 +189,9 @@ Outputs:
155189
SampleSqsBatchProcessorFunction:
156190
Description: "SQS Batch Handler - Lambda Function ARN"
157191
Value: !GetAtt SampleSqsBatchProcessorFunction.Arn
158-
SampleSqsBatchProcessorFunctionRole:
159-
Description: "Implicit IAM Role created for SQS Lambda Function ARN"
160-
Value: !GetAtt SampleSqsBatchProcessorFunctionRole.Arn
192+
DemoKinesisQueue:
193+
Description: "ARN for Kinesis Stream"
194+
Value: !GetAtt DemoKinesisStream.Arn
195+
DemoSQSConsumerFunction:
196+
Description: "SQS Batch Handler - Lambda Function ARN"
197+
Value: !GetAtt SampleKinesisEventBatchProcessorFunction.Arn

examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
9-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.105" />
10-
<PackageReference Include="AWSSDK.SQS" Version="3.7.200.25" />
9+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
10+
<PackageReference Include="AWSSDK.SQS" Version="3.7.200.43" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
12-
<PackageReference Include="Moq" Version="4.18.4" />
1312
<PackageReference Include="xunit" Version="2.4.2" />
1413
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1514
<PrivateAssets>all</PrivateAssets>

examples/Logging/src/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.6.0" />
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
1111
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.3.2" />
12-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.12" />
12+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
1313
</ItemGroup>
1414
</Project>

examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
9-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.12" />
9+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
1111
<PackageReference Include="NSubstitute" Version="5.1.0" />
1212
<PackageReference Include="xunit" Version="2.5.1" />

examples/Metrics/src/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
1111
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.3.2" />
1212
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="1.4.2" />
13-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.12" />
13+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
1414
</ItemGroup>
1515
</Project>

examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
9-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.12" />
9+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
1111
<PackageReference Include="NSubstitute" Version="5.1.0" />
1212
<PackageReference Include="xunit" Version="2.5.1" />

examples/Tracing/src/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
1111
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.3.2" />
1212
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.3.2" />
13-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.12" />
13+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.201.13" />
1414
</ItemGroup>
1515
</Project>

0 commit comments

Comments
 (0)