2

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>
Krishna
  • 43
  • 7

1 Answers1

1

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>...

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thanks for your response. I thought of using router instead of filter, but I have only one condition and don't have any flow other than going back to the original flow. I want to use the filter in the inner chain to prevent the rest of the flow inside the inner chain and it still need to be execute the flow in the Main chain. – Krishna Aug 20 '15 at 23:17
  • OK. It's your application and I'm sure eventually you will be able to make your solution more straightforward. Right now if you find my answer as correct one, just accept it and let's go ahead! – Artem Bilan Aug 21 '15 at 01:49
  • Your suggestion worked perfectly for what I was looking for, Thanks. – Krishna Aug 21 '15 at 15:04