adutra commented on code in PR #4064:
URL: https://github.com/apache/polaris/pull/4064#discussion_r2995705191


##########
runtime/service/src/main/java/org/apache/polaris/service/events/PolarisServiceBusEventDispatcher.java:
##########
@@ -40,6 +41,11 @@ public class PolarisServiceBusEventDispatcher implements 
PolarisEventDispatcher
    */
   @Override
   public void dispatch(PolarisEvent event) {
-    eventBus.publish(POLARIS_EVENT_CHANNEL, event);
+    eventBus.publish(POLARIS_EVENT_CHANNEL + "." + event, event);

Review Comment:
   Same here. There should be one channel per *event type*. 



##########
runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventListeners.java:
##########
@@ -41,13 +41,26 @@ public class PolarisEventListeners {
   @Inject @Any Instance<PolarisEventListener> eventListeners;
   @Inject PolarisEventListenerConfiguration configuration;
 
+  private final BitSet eventsByType = new 
BitSet(PolarisEventType.values().length);
+
   public void onStartup(@Observes StartupEvent event) {
-    Set<String> listenerTypeSet = 
configuration.types().orElseGet(HashSet::new);
+    var listenerTypeSet = configuration.types().orElseGet(HashSet::new);
     for (String enabledEventListener : listenerTypeSet) {
-      PolarisEventListener listener =
-          
eventListeners.select(Identifier.Literal.of(enabledEventListener)).get();
+      var listenerConfiguration = 
configuration.listenerConfig().get(enabledEventListener);
+      var supportedTypes = PolarisEventType.values();
+      if (listenerConfiguration != null && 
!listenerConfiguration.enabledEventTypes().isEmpty()) {
+        supportedTypes = 
listenerConfiguration.enabledEventTypes().toArray(PolarisEventType[]::new);
+      }
+      for (var polarisEventType : supportedTypes) {
+        eventsByType.set(polarisEventType.ordinal());
+      }
+      var listener = 
eventListeners.select(Identifier.Literal.of(enabledEventListener)).get();
       Handler<Message<PolarisEvent>> handler = e -> listener.onEvent(e.body());
-      eventBus.localConsumer(POLARIS_EVENT_CHANNEL, handler);
+      eventBus.localConsumer(POLARIS_EVENT_CHANNEL + "." + event, handler);

Review Comment:
   This doesn't look correct to me. Appending the startup event to the channel 
name does not make sense imho.



-- 
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]

Reply via email to