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>

examples/Tracing/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/examples.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E25EAD9C-E
6767
EndProject
6868
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Tests", "Tracing\test\HelloWorld.Test\HelloWorld.Tests.csproj", "{A1E1C702-77D3-4279-9E42-2A18783A0586}"
6969
EndProject
70+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BatchProcessing", "BatchProcessing", "{2B5E8DE7-8DA4-47B8-81B7-9E269CC77619}"
71+
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B95EAACA-FBE4-4CC0-B155-D0AD9BCDEE24}"
73+
EndProject
74+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "BatchProcessing\src\HelloWorld\HelloWorld.csproj", "{F33D0918-452F-4AB0-B842-E43AFE6F948D}"
75+
EndProject
76+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CE5C821F-5610-490F-B096-EE91F0E34C10}"
77+
EndProject
78+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld.Tests", "BatchProcessing\test\HelloWorld.Test\HelloWorld.Tests.csproj", "{AAE50681-1FEF-4D9E-9FEA-5406320BDB88}"
79+
EndProject
7080
Global
7181
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7282
Debug|Any CPU = Debug|Any CPU
@@ -128,6 +138,14 @@ Global
128138
{A1E1C702-77D3-4279-9E42-2A18783A0586}.Debug|Any CPU.Build.0 = Debug|Any CPU
129139
{A1E1C702-77D3-4279-9E42-2A18783A0586}.Release|Any CPU.ActiveCfg = Release|Any CPU
130140
{A1E1C702-77D3-4279-9E42-2A18783A0586}.Release|Any CPU.Build.0 = Release|Any CPU
141+
{F33D0918-452F-4AB0-B842-E43AFE6F948D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
142+
{F33D0918-452F-4AB0-B842-E43AFE6F948D}.Debug|Any CPU.Build.0 = Debug|Any CPU
143+
{F33D0918-452F-4AB0-B842-E43AFE6F948D}.Release|Any CPU.ActiveCfg = Release|Any CPU
144+
{F33D0918-452F-4AB0-B842-E43AFE6F948D}.Release|Any CPU.Build.0 = Release|Any CPU
145+
{AAE50681-1FEF-4D9E-9FEA-5406320BDB88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
146+
{AAE50681-1FEF-4D9E-9FEA-5406320BDB88}.Debug|Any CPU.Build.0 = Debug|Any CPU
147+
{AAE50681-1FEF-4D9E-9FEA-5406320BDB88}.Release|Any CPU.ActiveCfg = Release|Any CPU
148+
{AAE50681-1FEF-4D9E-9FEA-5406320BDB88}.Release|Any CPU.Build.0 = Release|Any CPU
131149
EndGlobalSection
132150
GlobalSection(NestedProjects) = preSolution
133151
{0CC66DBC-C1DF-4AF6-8EEB-FFED6C578BF4} = {526F1EF7-5A9C-4BFF-ABAE-75992ACD8F78}
@@ -156,5 +174,9 @@ Global
156174
{E3E9268B-5897-4A7D-BDC0-D5BF78269339} = {A5F586B6-DCE5-47A2-94B2-C8142A79BCF6}
157175
{E25EAD9C-E6DB-4F63-B7FA-7FB45AD0B09B} = {F5CAEA70-FF1A-4CCE-8928-D579AA7750BA}
158176
{A1E1C702-77D3-4279-9E42-2A18783A0586} = {E25EAD9C-E6DB-4F63-B7FA-7FB45AD0B09B}
177+
{B95EAACA-FBE4-4CC0-B155-D0AD9BCDEE24} = {2B5E8DE7-8DA4-47B8-81B7-9E269CC77619}
178+
{F33D0918-452F-4AB0-B842-E43AFE6F948D} = {B95EAACA-FBE4-4CC0-B155-D0AD9BCDEE24}
179+
{CE5C821F-5610-490F-B096-EE91F0E34C10} = {2B5E8DE7-8DA4-47B8-81B7-9E269CC77619}
180+
{AAE50681-1FEF-4D9E-9FEA-5406320BDB88} = {CE5C821F-5610-490F-B096-EE91F0E34C10}
159181
EndGlobalSection
160182
EndGlobal

0 commit comments

Comments
 (0)