问题
I have a problem in catching the exceptions in my spring integration application.
Flow of operations in my application.
- Http:inbound gateway which receives the request (error-channel defined to my custom error channel)
- Service Activator for basic validations (Exceptions which are thrown from here are handled by error-channel defined on the GW)
- splitter
- 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>
- But the same doesnt work when do the same on my Aggregator. why?
- Whenever there is an exception in my code, it retries and gets executed more than one time. why?
I have a "errorChannel" defined which logs the exceptions. it doesnt work.
回答1:
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.
来源:https://stackoverflow.com/questions/27387988/spring-integration-service-activator-error-channel-exception-handling