jbonofre commented on code in PR #4064:
URL: https://github.com/apache/polaris/pull/4064#discussion_r3031727630
##########
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:
nit: We have a bunch of boilerplate here around create/delete/etc.
Maybe it would be cleaner to a helper like
`dispatchIfListening(Supplier<PolarisEvent>)` or similar to simplify the
maintenance.
--
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]