dimas-b commented on code in PR #4064:
URL: https://github.com/apache/polaris/pull/4064#discussion_r3067157529


##########
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:
   Sorry for coming later to this party 😅 
   
   Using AOP is very interesting in this case. However, rather that using it on 
the leaf call to dispatch an event, we could generate the whole interceptor / 
delegator class (probably by making a Quarkus plugin) and only call the 
event-producing code when a listener is present.
   
   This would way outside the scope of current PR, though :)



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