GH-3452: Warn Publisher.onError in NullChannel (#3453)
* GH-3452: Warn Publisher.onError in NullChannel Fixes https://github.com/spring-projects/spring-integration/issues/3452 The `NullChannel` can subscribe to the `Publisher` payload fully ignoring the possible data according the `NullChannel` nature. However an error thrown from the reactive stream processing is also ignored. * Log WARN message from the `Subscriber.onError()` when `NullChannel` subscribes to the `Publisher` produced to this channel. * Mention the logic in the `NullChannel` docs; point to the `ReactiveRequestHandlerAdvice` for further possible error handling in the target application **Cherry-pick to `5.4.x`** * * Remove unused imports * * Fix `PseudoTransactionalMessageSourceTests` for `LogAccessor` from `NullChannel`
This commit is contained in:
committed by
Gary Russell
parent
5ed8c11c58
commit
ebe79aedfb
@@ -1145,6 +1145,8 @@ For example, you can use this technique to configure a test case to verify messa
|
||||
Two special channels are defined within the application context by default: `errorChannel` and `nullChannel`.
|
||||
The 'nullChannel' (an instance of `NullChannel`) acts like `/dev/null`, logging any message sent to it at the `DEBUG` level and returning immediately.
|
||||
The special treatment is applied for an `org.reactivestreams.Publisher` payload of a sent message: it is subscribed to in this channel immediately, to initiate reactive stream processing, although the data is discarded.
|
||||
An error thrown from a reactive stream processing (see `Subscriber.onError(Throwable)`) is logged under the warn level for possible investigation.
|
||||
If there is need to do anything with such an error, the `<<./handler-advice.adoc#reactive-advice,ReactiveRequestHandlerAdvice>>` with a `Mono.doOnError()` customization can be applied to the message handler producing `Mono` reply into this `nullChannel`.
|
||||
Any time you face channel resolution errors for a reply that you do not care about, you can set the affected component's `output-channel` attribute to 'nullChannel' (the name, 'nullChannel', is reserved within the application context).
|
||||
|
||||
The 'errorChannel' is used internally for sending error messages and may be overridden with a custom configuration.
|
||||
|
||||
Reference in New Issue
Block a user