java - error handling/propagation in spring integration -
java - error handling/propagation in spring integration -
i've read if exception thrown in flow first thing framework check message header error-channel property. case?
in particular case i'm assigning custom error-channel message header , yet message seems propagated stream nearest error-handler/error-channel.
<int:chain id="buildaggregatedresponsechain" input-channel="aggregatedresultchannel" output-channel="sendaggregatedchannel"> <int:header-enricher> <int:error-channel ref="myerrorchannel"/> </int:header-enricher> <int:service-activator ref="service" method="dosomething"/> </int:chain>
i explicitly throw exception within dosomething exception never ends in myerrorchannel. instead, "propagated" nearest errorhandler stream or error-channel specified stream int-mail:imap-idle-channel-adapter(tried several different flows). miss? maybe can outline main principal of error handling/error propagation(for illustration when talking several transactions, etc)? there info out there, quite scattered , not systematic.
it depends on upstream flow; if there's async handoff header consulted; otherwise, exception thrown inbound endpoint.
in general, advise against modifying framework headers such errorchannel
. instead set error-channel
on inbound endpoint (such imap idle adapter) , handle errors on flow.
modifying headers straight needed. if wish insert different error-handling mid-flow can insert messaging gateway...
<int:service activator ... ref="gw" /> <int:gateway id="gw" default-request-channel="..." error-channel="midflowerrorchannel" />
if downstream flow (from gateway) returns no result on success, sure add together default reply timeout of 0 (or utilize custom service interface method returns void).
java error-handling spring-integration
Comments
Post a Comment