I have a nested chain. I would like to add a filter in the inner chain so that it can continue with the flow under certain condition Or exit from the chain. If I don't set the discard-channel or set the discard-channel to "nullChannel", it hangs. So, I thought of routing to the replyChannel which is set in the headers by Spring. With the below configuration, I am getting SpelEvaluationException. How would I set the discard-channel to replyChannel? Please note Since I would like to call the childChannel multiple times, the replyChannel is not same all the time.
<int:chain id="parentChain" input-channel="request">
....
<int:gateway request-channel="childChannel" />
<int:header-enricher .. </header-enricher>
<int:gateway request-channel="childChannel" />
....
</int:chain>
<int:chain input-channel="childChannel">
..
<int-xml:xpath-filter discard-channel="#{headers['replyChannel']}">
<int-xml:xpath-expression expression="" />
</int-xml:xpath-filter>
..
</int:chain>