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


##########
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisCatalogsEventServiceDelegator.java:
##########
@@ -60,52 +60,64 @@ public class PolarisCatalogsEventServiceDelegator 
implements PolarisCatalogsApiS
   @Override
   public Response createCatalog(
       CreateCatalogRequest request, RealmContext realmContext, SecurityContext 
securityContext) {
-    polarisEventDispatcher.dispatch(
-        new PolarisEvent(
-            PolarisEventType.BEFORE_CREATE_CATALOG,
-            eventMetadataFactory.create(),
-            new EventAttributeMap()
-                .put(EventAttributes.CATALOG_NAME, 
request.getCatalog().getName())));
+    if 
(polarisEventDispatcher.hasListeners(PolarisEventType.BEFORE_CREATE_CATALOG)) {

Review Comment:
   Thanks Alex for the helping out with a detailed explanation. I think that 
the extra if statements don't add much complexity. My only concern is what I 
mentioned before: one can easily forget wrapping the dispatch calls around. 
Also, I don't think we can easily verify, that anytime one calls dispatch, it 
is wrapped around with that if statement. Nonetheless, I also vote keeping this 
approach.



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