Arsnael commented on code in PR #2991:
URL: https://github.com/apache/james-project/pull/2991#discussion_r3032210245
##########
event-bus/api/src/main/java/org/apache/james/events/EventSerializersAggregator.java:
##########
@@ -37,70 +37,34 @@ public EventSerializersAggregator(Set<EventSerializer>
allEventSerializers) {
}
@Override
- public String toJson(Event event) {
+ public Optional<String> toJson(Event event) {
return allEventSerializers.stream()
- .map(eventSerializer -> serialize(event, eventSerializer))
+ .map(eventSerializer -> eventSerializer.toJson(event))
.flatMap(Optional::stream)
- .findFirst()
- .orElseThrow(() -> new RuntimeException("Could not serialize
event: " + event));
+ .findFirst();
Review Comment:
I ain't sure here if we should still throw after we passed through all
serializers and nothing worked or if we return Optional.empty()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]