1
votes

I have a problem in catching the exceptions in my spring integration application.

Flow of operations in my application.

  1. Http:inbound gateway which receives the request (error-channel defined to my custom error channel)
  2. Service Activator for basic validations (Exceptions which are thrown from here are handled by error-channel defined on the GW)
  3. splitter
  4. Aggregator

Exceptions on my splitter or Aggregator are not handled by my error channel. why?

Steps taken:

I added a chain and included a header enricher and specified an error channel just before the splitter.

After this, any exception on my splitter is handled by my error channel mentioned in the header enricher.

<chain input-channel="invitations">
        <header-enricher>
            <error-channel ref="failed-invitations" />
        </header-enricher>
        <int:splitter ref="payloadSplitter" />
    </chain>
  1. But the same doesnt work when do the same on my Aggregator. why?
  2. Whenever there is an exception in my code, it retries and gets executed more than one time. why?
  3. I have a "errorChannel" defined which logs the exceptions. it doesnt work.


1
Sorry, not enough info. Whould be great if you'd share entire config to have a chance to reproduce it.Artem Bilan
@Artem Bilan Added the config xmlprakash
You generally should not be messing with the headers that way; simply add an error-channel to the inbound gateway. We need to see much more of your configuration - for example, you don't have an output-channel on that chain.Gary Russell
@Gary Russell I was not able to post the complete xml here, due to size restriction. Please suggest a way to send you the complete xmlprakash
You can share it as public gist.github.com. And leave comments on the lines, please.Artem Bilan

1 Answers

0
votes

I know the thread is too old, but I was also facing a similar issue and found I declared error-channel in header-enricher but not provide 'overwrite="true"' as a parameter. And after providing 'overwrite="true"'it is working as needed. I am surprised why spring integration does not provide an overwrite=true by default.

Let us know this is what solution you did in your old code? So everyone can find out the solution for such a scenario.