aws / aws/aws-sdk-java-v2

Handle 's3:TestEvent' events in S3EventNotification library

Offen
#6,482 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature-request p3
Vorherrschende Sprache
Java
Sterne
2.6k
Forks
1k
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
51

Beschreibung

### Describe the feature

The [s3-event-notification](https://github.com/aws/aws-sdk-java-v2/tree/master/services-custom/s3-event-notifications) library is currently used by us to parse s3 notification that come via SQS.
However, not only do we receive s3 events about new ojects in a bucket (etc.), but also [s3 test events](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html#notification-content-structure-examples). Those notifications do not contain any records and the result of `S3EventNotification.fromJson(myS3Notification)` is therefore null ([see here](https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/s3-event-notifications/src/main/java/software/amazon/awssdk/eventnotifications/s3/internal/DefaultS3EventNotificationReader.java#L66-L67)).

We handle this with a null check, but it would be great if there is a convenience method (`boolean isTestEven()`?).

### Use Case

We monitor the errors around the event consumption. At the moment, we check
```java
s3EventNotification.getRecords() == null || s3EventNotification.getRecords().isEmpty()){
LOG.error("SQS message did not contain any S3 notifications: {}", sqsMessage.getText());
throw new CustomException("no messages!");
}
```
If we had a convenience method `isTestEven()` (or similar), we could filter them out and reduce noise on our monitoring.

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS Java SDK version used

2.31.25

### JDK version used

OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)

### Operating System and version

Ubuntu 22.04.5 LTS

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne in services-custom/s3-event-notifications, insbesondere in DefaultS3EventNotificationReader.java, und untersuche das null-Ergebnis für Benachrichtigungen ohne Records. Lies die Struktur des S3-Testereignisses in der verlinkten AWS-Dokumentation und prüfe vorhandene Library-Tests. Die Aufgabe ist abgeschlossen, wenn Aufrufer s3:TestEvent-Benachrichtigungen über eine unterstützte Convenience-API erkennen können, ohne sich auf eine Nullprüfung zu stützen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, java
Bereich
cloud
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
64/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.