adutra commented on code in PR #2962:
URL: https://github.com/apache/polaris/pull/2962#discussion_r2493593552
##########
runtime/service/src/main/java/org/apache/polaris/service/events/listeners/aws/cloudwatch/AwsCloudWatchEventListener.java:
##########
@@ -71,13 +78,38 @@ public class AwsCloudWatchEventListener extends
PropertyMapEventListener {
public AwsCloudWatchEventListener(
AwsCloudWatchConfiguration config,
Clock clock,
- PolarisIcebergObjectMapperCustomizer customizer) {
+ PolarisIcebergObjectMapperCustomizer customizer,
+ ObjectMapper mapper) {
this.logStream = config.awsCloudWatchLogStream();
this.logGroup = config.awsCloudWatchLogGroup();
this.region = Region.of(config.awsCloudWatchRegion());
this.synchronousMode = config.synchronousMode();
this.clock = clock;
+ this.objectMapper = mapper;
customizer.customize(this.objectMapper);
+ this.listenToAllEvents =
+ config.eventTypes().isEmpty()
+ || config.eventTypes().map(Set::isEmpty).orElse(true)
+ || config.eventTypes().get().stream().anyMatch(e -> e ==
PolarisEvent.class);
+ this.allowedEventTypes = listenToAllEvents ? Set.of() :
Set.copyOf(config.eventTypes().get());
+ }
+
+ @Override
+ protected boolean shouldHandle(Object event) {
+ if (!(event instanceof PolarisEvent polarisEvent)) {
+ return false;
+ }
+
+ if (this.listenToAllEvents) {
+ return true;
+ }
+ Class<? extends PolarisEvent> actualType = polarisEvent.getClass();
Review Comment:
Yes that's roughly the idea I have in mind, see this thread on the ML:
https://lists.apache.org/thread/yx7pkgczl6k7bt4k4yzqrrq9gn7gqk2p
But let's do this later, I think this PR is close to mergeable, so let's try
to get it in as soon as possible. The current code is acceptable for now.
--
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]