spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

Use dedicated task executor for `@ApplicationModuleListener`s

Open odrotbohm opened this issue 1 year ago • 2 comments
trafficstars

@ApplicationModuleListeners need dedicated control over the Executor running them, for example, to enable tracing context propagation in the observability module. To contain the impact of such a customization, it makes sense to use a dedicated Executor.

Implementation considerations

  • Register a dedicated ThreadPoolTaskExecutor/SimpleAsyncTaskExecutor with a dedicated name and refer to that from the @Async annotation on @ApplicationModuleListener (@ConditionalOnThreading, @ConditionalOnMissingBean)

References

  • GH-637

odrotbohm avatar May 24 '24 10:05 odrotbohm

Will it be possible to configure the Executor or extend its functionality? Our application configures a custom TaskDecorator. Currently, we use a custom aspect to get the same functionality for @ApplicationModuleListener.

danstooamerican avatar May 27 '24 20:05 danstooamerican

Yes, you'll be able to override the bean by name. Or use a BeanPostProcessor to find and customize it.

odrotbohm avatar May 27 '24 20:05 odrotbohm

Hi team,

Hope you're doing well.

I'm just checking in on this issue regarding the dedicated task executor for @ApplicationModuleListeners. Being able to configure this executor would be very helpful for managing listener concurrency and integrating with observability tools in my application.

I was wondering if there have been any updates on the progress for this enhancement, or if it might be tentatively planned for a future release milestone?

I am also willing to contribute to implementing these changes if the team is open to external contributions in these areas.

michalkopacz avatar Apr 11 '25 14:04 michalkopacz