Krishna
Krishna

Reputation: 43

Spring Integration discard message to replyChannel

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>

Upvotes: 2

Views: 1112

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121272

Not sure that your logic is correct, but you really can't discard that way.

You can do something like this:

<int-xml:xpath-filter discard-channel="discardChannel">
...

<int:header-value-router input-channel="discardChannel" header-name="replyChannel"/>

The Filter pattern (and its component respectively) is for those messages which shouldn't go to the main downstream.

I just think that you should use something different, rather than <filter>...

Upvotes: 1

Related Questions