dimas-b commented on code in PR #4616:
URL: https://github.com/apache/polaris/pull/4616#discussion_r3357169037
##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -459,4 +461,27 @@ public PolarisMetricsReporter metricsReporter(
MetricsReportingConfiguration config, @Any
Instance<PolarisMetricsReporter> reporters) {
return reporters.select(Identifier.Literal.of(config.type())).get();
}
+
+ @Produces
+ @Singleton
+ @Identifier("event-listener-executor")
+ public Executor eventListenerExecutor(PolarisEventListenerConfiguration
config) {
+ if (config.types().isEmpty()) {
+ return r -> {};
Review Comment:
Maybe always reject?
##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -459,4 +461,27 @@ public PolarisMetricsReporter metricsReporter(
MetricsReportingConfiguration config, @Any
Instance<PolarisMetricsReporter> reporters) {
return reporters.select(Identifier.Literal.of(config.type())).get();
}
+
+ @Produces
+ @Singleton
+ @Identifier("event-listener-executor")
+ public Executor eventListenerExecutor(PolarisEventListenerConfiguration
config) {
+ if (config.types().isEmpty()) {
+ return r -> {};
+ }
+ return SmallRyeManagedExecutor.builder()
+ .injectionPointName("event-listener-executor")
+ .propagated(ThreadContext.ALL_REMAINING)
+ .cleared(ThreadContext.CDI)
Review Comment:
This is fine, but may break existing listeners' expectations, I guess 🤔
I'm still +1 to clear CDI context for events. Conceptually listeners should
start a new CDI request context.
##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -459,4 +461,27 @@ public PolarisMetricsReporter metricsReporter(
MetricsReportingConfiguration config, @Any
Instance<PolarisMetricsReporter> reporters) {
return reporters.select(Identifier.Literal.of(config.type())).get();
}
+
+ @Produces
+ @Singleton
+ @Identifier("event-listener-executor")
+ public Executor eventListenerExecutor(PolarisEventListenerConfiguration
config) {
+ if (config.types().isEmpty()) {
+ return r -> {};
+ }
+ return SmallRyeManagedExecutor.builder()
+ .injectionPointName("event-listener-executor")
Review Comment:
Just wondering if we perhaps could / should reuse the `task-executor` pool?
WDYT?
##########
runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventListeners.java:
##########
@@ -69,7 +74,8 @@ public void onStartup(@Observes StartupEvent event) {
}
var listener =
eventListeners.select(Identifier.Literal.of(enabledEventListener)).get();
Handler<Message<PolarisEvent>> handler =
- message -> deliverEvent(message.body(), enabledEventListener,
listener);
+ message ->
+ executor.execute(() -> deliverEvent(message.body(),
enabledEventListener, listener));
Review Comment:
Good point from Copilot, I think 🤔
--
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]