3
3
// See the LICENSE file in the project root for more information
4
4
5
5
using System . Collections . Concurrent ;
6
+ using System . Text . Json ;
6
7
using Amazon . Lambda . Core ;
7
8
using Amazon . Lambda . RuntimeSupport ;
8
9
using Amazon . Lambda . Serialization . SystemTextJson ;
9
10
using Amazon . Lambda . SQSEvents ;
10
11
using Amazon . S3 ;
11
12
using Amazon . S3 . Util ;
12
- using Elastic . Documentation ;
13
13
using Elastic . Documentation . Lambda . LinkIndexUploader ;
14
14
using Elastic . Documentation . Links ;
15
15
@@ -30,6 +30,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
30
30
var batchItemFailures = new List < SQSBatchResponse . BatchItemFailure > ( ) ;
31
31
foreach ( var message in ev . Records )
32
32
{
33
+ context . Logger . LogInformation ( "Processing message {MessageId}" , message . MessageId ) ;
34
+ context . Logger . LogInformation ( "Message body: {MessageBody}" , message . Body ) ;
33
35
try
34
36
{
35
37
var s3RecordLinkReferenceTuples = await GetS3RecordLinkReferenceTuples ( s3Client , message , context ) ;
@@ -55,6 +57,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
55
57
var response = new SQSBatchResponse ( batchItemFailures ) ;
56
58
if ( batchItemFailures . Count > 0 )
57
59
context . Logger . LogInformation ( "Failed to process {batchItemFailuresCount} of {allMessagesCount} messages. Returning them to the queue." , batchItemFailures . Count , ev . Records . Count ) ;
60
+ var jsonStr = JsonSerializer . Serialize ( response , SerializerContext . Default . SQSBatchResponse ) ;
61
+ context . Logger . LogInformation ( jsonStr ) ;
58
62
return response ;
59
63
}
60
64
catch ( Exception ex )
@@ -67,6 +71,8 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
67
71
{
68
72
ItemIdentifier = r . MessageId
69
73
} ) . ToList ( ) ) ;
74
+ var jsonStr = JsonSerializer . Serialize ( response , SerializerContext . Default . SQSBatchResponse ) ;
75
+ context . Logger . LogInformation ( jsonStr ) ;
70
76
return response ;
71
77
}
72
78
}
0 commit comments