Subscribe to Publisher in the NullChannel (#3448)
* Subscribe to Publisher in the NullChannel If a payload of the message in the flow is a `org.reactivestreams.Publisher`, it must be subscribed somewhere downstream to initiate reactive processing. The `NullChannel` just ignores the message altogether and therefore `Publisher` is lost * Check the payload of the message in the `NullChannel` for `Publisher` type and subscribe to it * Verify in the test and mention this logic in the docs **Cherry-pick to 5.4.x** * Apply suggestions from code review Co-authored-by: Gary Russell <grussell@vmware.com> Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
@@ -1142,9 +1142,11 @@ For example, you can use this technique to configure a test case to verify messa
|
||||
[[channel-special-channels]]
|
||||
==== Special Channels
|
||||
|
||||
If namespace support is enabled, two special channels are defined within the application context by default: `errorChannel` and `nullChannel`.
|
||||
The 'nullChannel' acts like `/dev/null`, logging any message sent to it at the `DEBUG` level and returning immediately.
|
||||
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.
|
||||
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.adoc#error-handling,Error Handling>>.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user