We now reflectively invoke ApplicationListenerMethodAdapter.shouldHandle(…) when selecting event listeners to make sure that conditions defined in, for example, @TransactionalEventListener are considered before registering an event publication.
We now clearly separate between strict configuration, usable via @EnablePersistentDomainEvents and the auto-configuration for EventPublicationRegistry infrastructure. This allows using the core JAR in scenarios, in which no registry functionality is needed.
Changed the EventPublicationRepository interface to allow marking an event as completed without having to materialize it in the first place. This allows us to get rid of CompletableEventPublication. EventPublication not exposes its identifier to make sure the stores can actually store the same id.
Introduced EventPublicationRegistry.deleteCompletedPublicationsOlderThan(Duration) to purge completed event publications before a given point in time.
We now opt out of defining bean definitions for MongoTransactionManager and TransactionTemplate if user defined. We also make sure to run before the EnableTransactionManagementConfiguration to make sure that will see our auto-configured MongoTransactionManager.
As the Event Publication registry only works in transactional environments, we should enable them for MongoDB by default. This will require a replica setup for the MongoDB instance the application interacts with.
AbstractApplicationEventMulticaster.supportsEvent(…) currently doesn't properly match unresolved, generic ApplicationEvents (see [0]). We now work around this problem by additionally matching the raw event types in a custom override of supportsEvent(…).
[0] https://github.com/spring-projects/spring-framework/issues/30399
We now avoid to initialize the EventPublicationRegistry in the ApplicationEventMulticaster unless there is a transactional event listener interested in the event to be published. This should help us avoid premature initialization of the registry for application events published early in the application context bootstrap phase.
We now tweak the task executor to await termination for 2 seconds unless explicitly disabled or any of the Spring Boot task executor shutdown properties being set. This makes sure that long running application module listeners do not access resources already in shutdown when running integration tests, in which the context could already shutdown while the listener is still running.