nandorKollar commented on code in PR #4064:
URL: https://github.com/apache/polaris/pull/4064#discussion_r3032639218
##########
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:
Ideally, we should use AOP for events, with Quarkus `@AroundInvoke` and
introducing an `@PolarisEvent` annotation we could make this simple and clean.
The problem is that I couldn't find a way to pass the event attribute map.
I'm also not too happy with the bolierplate if-s, it is very easy to forget
that later when a new event is added, however I don't know what could be a
better alternative. Like @adutra mentioned, using lambdas is also suboptimal
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]