简体   繁体   中英

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?

I think I found a solution.

Serialize : new RecordAdapter(record).getData

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

Thank you, Jason

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM