Unable to unmarshal S3 Event Notification
Describe the bug
While trying to unmarshal s3eventnotification message to S3EventNotification.S3EventNotificationRecord using below line, getting error. unmarshal().json(JsonLibrary.Jackson, S3EventNotification.S3EventNotificationRecord.class)
Expected Behavior
S3event message should unmarshal to the object.
Current Behavior
Getting below error. com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Type" (class com.amazonaws.services.s3.event.S3EventNotification$S3EventNotificationRecord), not marked as ignorable (10 known properties: "s3", "awsRegion", "eventName", "eventTime", "responseElements", "requestParameters", "eventVersion", "eventSource", "userIdentity", "glacierEventData"])
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Type" (class com.amazonaws.services.s3.event.S3EventNotification$S3EventNotificationRecord), not marked as ignorable (10 known properties: "s3", "awsRegion", "eventName", "eventTime", "responseElements", "requestParameters", "eventVersion", "eventSource", "userIdentity", "glacierEventData"])
Steps to Reproduce
Unmarshal the s3event notification using java application unmarshal().json(JsonLibrary.Jackson, S3EventNotification.S3EventNotificationRecord.class)
Possible Solution
There should be property to hold "Type" value or it should be under ignoreproperty.
Context
Your Environment
- AWS Java SDK version used: 1.11.961
- JDK version used: 1.8.181
- Operating System and version: RHEL7
@arivukkarasu2007 can you please provide a minimal reproducible code?
I mean a full example, more than just this line:
unmarshal().json(JsonLibrary.Jackson, S3EventNotification.S3EventNotificationRecord.class)
@debora-ito i am using Apache camel frame work to consume message from sqs queue , S3 notifications.
from(aws-sqs://
Above is all the code.
@arivukkarasu2007 A few suggestions to help debug faster:
- Provide a sample record that can be used for testing.
- Have you tried deserializing it with Jackson without using Apache Camel? If not, how can we be sure that it is an issue with AWS-SDK rather than Apache Camel?
- From the code sample you have provided, it seems you are directly unmarshalling the raw message to S3EventNotificationRecord instead of extracting the value from it (i.e. MessageBody). Is that what could be causing this issue?
Closing for staleness and low interest (upvotes or recent comments).
COMMENT VISIBILITY WARNING
Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.