Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to serialize and deserialize DynamoDB Stream Record object

We are planning to use DynamoDB Stream, part of stream processing we need com.amazonaws.services.dynamodbv2.model.Record object to be serialized and deserialized. I know we can do java ObjectOutputStream and ObjectInputStream, but this does not suffice our needs.

The need is we have to manage versions in deserializer and serializer because if there is a change in Record structure or new version, we can not upgrade all the services which use deserializer to upgrade at one shot.

Is there a way to do this?

like image 387
Gajendra Naidu Avatar asked Oct 27 '25 05:10

Gajendra Naidu


1 Answers

I think I found a solution.

Serialize : new RecordAdapter(record).getData

Deserialize: new RecordObjectMapper().readValue(new String(bytes), Record.class)

Thank you, Jason

like image 61
Gajendra Naidu Avatar answered Oct 29 '25 07:10

Gajendra Naidu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!