adutra commented on PR #3293:
URL: https://github.com/apache/polaris/pull/3293#issuecomment-3737852429
Thanks a lot for this awesome work @olsoloviov !
A minor improvement that comes to my mind right now: when there is no
listener (e.g. if `polaris.event-listener.type=no-op`), or when the listener is
not "interested" in all events (e.g. the CloudWatch listener), instantiating a
`PolarisEvent` + `PolarisEventMetadata` + `AttributeMap` is useless. We should
come up with a way to conditionally create events only when necessary. E.g.:
```java
public Response createCatalog(
CreateCatalogRequest request, RealmContext realmContext, SecurityContext
securityContext) {
if
(polarisEventListener.isEventEnabled(PolarisEventType.BEFORE_CREATE_CATALOG)) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.BEFORE_CREATE_CATALOG,
eventMetadataFactory.create(),
new AttributeMap()
.put(EventAttributes.CATALOG_NAME,
request.getCatalog().getName())));
}
Response resp = delegate.createCatalog(request, realmContext,
securityContext);
if
(polarisEventListener.isEventEnabled(PolarisEventType.AFTER_CREATE_CATALOG)) {
polarisEventListener.onEvent(
new PolarisEvent(
PolarisEventType.AFTER_CREATE_CATALOG,
eventMetadataFactory.create(),
new AttributeMap().put(EventAttributes.CATALOG, (Catalog)
resp.getEntity())));
}
return resp;
}
```
Wdyt?
--
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]