Use specific data type transformation to marshal the aws2-ddb record domain model to Json
Arbitrary Gson marshalling is not able to handle Java time instant type that is being used in aws2-ddb domain model
Add Java time instant Gson type adapter
Use Gson with timer instant type adapter in aws2-ddb Json Struct data type transformer
Add YAKS test to verify aws2-ddb-streams-source Kamelet
AWS DDB Streams source Kamelet raises error during marshal operation. This is due to Gson library not able to handle Java time instant type OOTB. PR introduces a data type transformer in camel-kamelets-utils library to handle Gson marshalling in aws2-ddb-streams-source Kamelet.
Errors raised looked like this:
Source ID Processor Elapsed (ms)
aws-ddb-streams-source.kamelet.yaml:129 source/source from[aws2-ddbstream://DynamoDBSourceKameletITCase1 254789243
...
aws-ddb-streams-source.kamelet.yaml:140 source/marshal1 marshal[org.apache.camel.model.dataformat.JsonData 0
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------:
com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either increase its visibility or write a custom TypeAdapter for its declaring type.
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.time.Instant.seconds accessible: module java.base does not "opens java.time" to unnamed module @8e0379d
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:35)
AWS DDB Streams source Kamelet raises error during marshal operation. This is due to Gson library not able to handle Java time instant type OOTB. PR introduces a data type transformer in camel-kamelets-utils library to handle Gson marshalling in aws2-ddb-streams-source Kamelet.
Errors raised looked like this: