Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,529 changes: 985 additions & 544 deletions docs/utilities/batch-processing.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/BatchProcessing/events/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1545082649183",
"SenderId": "AIDAIENQZJOLO23YVJ4VO",
"SenderId": "SENDER_ID",
"ApproximateFirstReceiveTimestamp": "1545082649185"
},
"messageAttributes": {},
Expand All @@ -23,7 +23,7 @@
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1545082649183",
"SenderId": "AIDAIENQZJOLO23YVJ4VO",
"SenderId": "SENDER_ID",
"ApproximateFirstReceiveTimestamp": "1545082649185"
},
"messageAttributes": {},
Expand Down
82 changes: 82 additions & 0 deletions examples/BatchProcessing/events/typed-dynamodb-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"Records": [
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"customerId": {
"S": "CUST-123"
}
},
"NewImage": {
"customerId": {
"S": "CUST-123"
},
"name": {
"S": "John Doe"
},
"email": {
"S": "[email protected]"
},
"createdAt": {
"S": "2024-01-15T10:30:00Z"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "111",
"SizeBytes": 26
},
"awsRegion": "us-west-2",
"eventName": "INSERT",
"eventSourceARN": "arn:aws:dynamodb:us-west-2:123456789012:table/customers/stream/2015-06-27T00:48:05.899",
"eventSource": "aws:dynamodb"
},
{
"eventID": "2",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"customerId": {
"S": "CUST-124"
}
},
"NewImage": {
"customerId": {
"S": "CUST-124"
},
"name": {
"S": "Jane Smith"
},
"email": {
"S": "[email protected]"
},
"createdAt": {
"S": "2024-01-15T10:35:00Z"
}
},
"OldImage": {
"customerId": {
"S": "CUST-124"
},
"name": {
"S": "Jane Doe"
},
"email": {
"S": "[email protected]"
},
"createdAt": {
"S": "2024-01-15T10:35:00Z"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "222",
"SizeBytes": 59
},
"awsRegion": "us-west-2",
"eventName": "MODIFY",
"eventSourceARN": "arn:aws:dynamodb:us-west-2:123456789012:table/customers/stream/2015-06-27T00:48:05.899",
"eventSource": "aws:dynamodb"
}
]
}
36 changes: 36 additions & 0 deletions examples/BatchProcessing/events/typed-kinesis-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Records": [
{
"kinesis": {
"kinesisSchemaVersion": "1.0",
"partitionKey": "order-1",
"sequenceNumber": "49590338271490256608559692538361571095921575989136588898",
"data": "eyJvcmRlcklkIjogIk9SRC0xMjMiLCAib3JkZXJEYXRlIjogIjIwMjQtMDEtMTVUMTA6MzA6MDBaIiwgImN1c3RvbWVySWQiOiAiQ1VTVC0xMjMiLCAiaXRlbXMiOiBbeyJpZCI6IDEsICJuYW1lIjogIkxhcHRvcCIsICJwcmljZSI6IDk5OS45OX0sIHsiaWQiOiAyLCAibmFtZSI6ICJNb3VzZSIsICJwcmljZSI6IDI5Ljk5fV0sICJ0b3RhbEFtb3VudCI6IDEwMjkuOTgsICJzdGF0dXMiOiAiUGVuZGluZyJ9",
"approximateArrivalTimestamp": 1545084650.987
},
"eventSource": "aws:kinesis",
"eventVersion": "1.0",
"eventID": "shardId-000000000006:49590338271490256608559692538361571095921575989136588898",
"eventName": "aws:kinesis:record",
"invokeIdentityArn": "arn:aws:iam::123456789012:role/lambda-kinesis-role",
"awsRegion": "us-east-1",
"eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/lambda-stream"
},
{
"kinesis": {
"kinesisSchemaVersion": "1.0",
"partitionKey": "order-2",
"sequenceNumber": "49590338271490256608559692538361571095921575989136588899",
"data": "eyJvcmRlcklkIjogIk9SRC0xMjQiLCAib3JkZXJEYXRlIjogIjIwMjQtMDEtMTVUMTA6MzU6MDBaIiwgImN1c3RvbWVySWQiOiAiQ1VTVC0xMjQiLCAiaXRlbXMiOiBbeyJpZCI6IDMsICJuYW1lIjogIktleWJvYXJkIiwgInByaWNlIjogNzkuOTl9XSwgInRvdGFsQW1vdW50IjogNzkuOTksICJzdGF0dXMiOiAiUGVuZGluZyJ9",
"approximateArrivalTimestamp": 1545084651.987
},
"eventSource": "aws:kinesis",
"eventVersion": "1.0",
"eventID": "shardId-000000000006:49590338271490256608559692538361571095921575989136588899",
"eventName": "aws:kinesis:record",
"invokeIdentityArn": "arn:aws:iam::123456789012:role/lambda-kinesis-role",
"awsRegion": "us-east-1",
"eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/lambda-stream"
}
]
}
52 changes: 52 additions & 0 deletions examples/BatchProcessing/events/typed-sqs-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"Records": [
{
"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78",
"receiptHandle": "MessageReceiptHandle",
"body": "{\"id\": 1, \"name\": \"Laptop Computer\", \"price\": 999.99}",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1523232000000",
"SenderId": "123456789012",
"ApproximateFirstReceiveTimestamp": "1523232000001"
},
"messageAttributes": {},
"md5OfBody": "7b270e59b47ff90a553787216d55d91d",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue",
"awsRegion": "us-east-1"
},
{
"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb79",
"receiptHandle": "MessageReceiptHandle2",
"body": "{\"id\": 2, \"name\": \"Wireless Mouse\", \"price\": 29.99}",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1523232000000",
"SenderId": "123456789012",
"ApproximateFirstReceiveTimestamp": "1523232000001"
},
"messageAttributes": {},
"md5OfBody": "7b270e59b47ff90a553787216d55d92e",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue",
"awsRegion": "us-east-1"
},
{
"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb80",
"receiptHandle": "MessageReceiptHandle3",
"body": "{\"id\": 999, \"name\": \"Invalid Product\", \"price\": -10.00}",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1523232000000",
"SenderId": "123456789012",
"ApproximateFirstReceiveTimestamp": "1523232000001"
},
"messageAttributes": {},
"md5OfBody": "7b270e59b47ff90a553787216d55d93f",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue",
"awsRegion": "us-east-1"
}
]
}
50 changes: 50 additions & 0 deletions examples/BatchProcessing/src/HelloWorld/Data/Order.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace HelloWorld.Data;

public class Order
{
public string? OrderId { get; set; }
public DateTime OrderDate { get; set; }
public string? CustomerId { get; set; }
public List<Product> Items { get; set; } = new();
public decimal TotalAmount { get; set; }
public string? Status { get; set; }
}

public class Customer
{
public string? CustomerId { get; set; }
public string? Name { get; set; }
public string? Email { get; set; }
public DateTime CreatedAt { get; set; }
}

/// <summary>
/// JsonSerializerContext for AOT compatibility
/// </summary>
[JsonSerializable(typeof(Product))]
[JsonSerializable(typeof(Order))]
[JsonSerializable(typeof(Customer))]
[JsonSerializable(typeof(List<Product>))]
[JsonSerializable(typeof(List<Order>))]
public partial class ExampleJsonSerializerContext : JsonSerializerContext
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<!-- Package versions are Centrally managed in Directory.Packages.props file -->
<!-- More info https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management -->
<PackageReference Include="Amazon.Lambda.Core" />
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" />
<PackageReference Include="Amazon.Lambda.KinesisEvents" />
<PackageReference Include="Amazon.Lambda.SQSEvents" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/


using System.Collections.Generic;
using System.Runtime.Serialization;
Expand Down
Loading
Loading