aws sdk: Where is located S3EventNotification

23 Views Asked by At

Here my SQS listener class:

@RequiredArgsConstructor
@Slf4j
@Service
public class SQSS3CreatedNotificationService {

    private final FluxProperties fluxProperties;
    private final ConsolidateDocumentInputPort consolidateDocumentInputPort;

    @SqsListener("#{fluxProperties.getS3CreatedNotificationQueueName()}")
    public void listen(final Message s3EventNotification) {
        log.trace("Message received: {}", s3EventNotification.body());

        consolidateDocumentInputPort.consolidate(UUID.randomUUID());
    }
}

As you can see, I'm using Message class parameter in order to receive SQS message.

This is sqs message is an S3 Event. I write the log.trace("Message received: {}", s3EventNotification.body()); formated output here:

{
  "Records": [
    {
      "eventVersion": "2.1",
      "eventSource": "aws:s3",
      "awsRegion": "us-east-1",
      "eventTime": "2024-02-16T13:35:26.982Z",
      "eventName": "ObjectCreated:Put",
      "userIdentity": {
        "principalId": "AIDAJDPLRKLG7UEXAMPLE"
      },
      "requestParameters": {
        "sourceIPAddress": "127.0.0.1"
      },
      "responseElements": {
        "x-amz-request-id": "234d0f2e",
        "x-amz-id-2": "eftixk72aD6Ap51TnqcoF8eFidJG9Z/2"
      },
      "s3": {
        "s3SchemaVersion": "1.0",
        "configurationId": "38240f0e",
        "bucket": {
          "name": "espaidoc",
          "ownerIdentity": {
            "principalId": "A3NL1KOZZKExample"
          },
          "arn": "arn:aws:s3:::espaidoc"
        },
        "object": {
          "key": "references/reference1.sha",
          "sequencer": "0055AED6DCD90281E5",
          "size": 2333,
          "eTag": "1d11469e9d81f07729548d7708bbab82"
        }
      }
    }
  ]
}

I don't quite if it possible to serialize it to a already defined class on sdk.

0

There are 0 best solutions below