Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AWS DDB Streams Source Kamelet #2008

Merged

Conversation

christophd
Copy link
Contributor

@christophd christophd commented Apr 29, 2024

  • 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)

- 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
@christophd christophd merged commit 5117842 into apache:main Apr 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants