Special Channels
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 transmitted 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 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. This is discussed in greater detail in Error Handling.
See also Message Channels in the Java DSL chapter for more information about message channel and interceptors.