'How to convert SQSevent to DynamodbEvent in Java

I have an AWS lambda function using DynamodbEvent as input.

I have another AWS lambda function using SQSEvent as input. And I would like to convert this SQSEvent to DynamodbEvent so that I can call my first lambda using InvokeRequest method.

I haven't found any direct solution yet. Seems like I have to build classes myself to do this. If you know any good way to convert SQSEvent to DynamodbEvent please let me know.

Thank you so much!



Solution 1:[1]

I resolved this issue. In case anyone found this useful.

I was thinking sending to queue using "objectMapper.writeValueAsString" and "objectMapper.readValue(item.toJSON(), DynamodbEvent.class)" to get the data.

The problem is that DynamodbEvent cannot be serialized since it's not a valid json. The work around is to directly call handler with DynamodbEvent as input instead of converting.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Lee