GH-9854: Special error for "too early message production"
Fixes: https://github.com/spring-projects/spring-integration/issues/9854 The well-known `Dispatcher has no subscribers` is not very informative when a message is produced from early application context initialization phase * Add internal `ApplicationRunningController` bean to handle early `start()` event * Check for this bean status from the `AbstractMessageChannel.send()` * Throw specific `MessageDispatchingException` to indicate that the message was produced from a wrong place * Adjust `ApplicationEventListeningMessageProducer` logic for `ContextStoppedEvent` & `ContextClosedEvent` to indicate that `AbstractMessageChannel` bean might not dispatch a message because the application context is not running
This commit is contained in:
@@ -27,6 +27,10 @@ The `AbstractCorrelatingMessageHandler` does not throw an `IllegalArgumentExcept
|
||||
Instead, such a collection is wrapped into a single reply message.
|
||||
See xref:aggregator.adoc[Aggregator] for more information.
|
||||
|
||||
The `AbstractMessageChannel` beans now throw a special `MessageDispatchingException` when an attempt to send a message to not running application is done.
|
||||
In general, it is a design error to try to produce a message from `afterPropertiesSet()`, `@PostConstruct` or bean definition methods.
|
||||
The `SmartLifecycle.start()` is preferred way for this kind of logic, or better to do that via inbound channel adapters.
|
||||
|
||||
[[x6.5-correlation-changes]]
|
||||
== The `discardIndividuallyOnExpiry` Option For Correlation Handlers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user