Spring Integration: How to send response packet to client in case of exception using error-channel? -


i using spring integration in project. endpoints used in application in-bound gateway, header based router, transformer, spliter, service activator.

in case of success flow(not exception), in-bound gateway reply-channel getting desired response , client gets response fine in case of exception, want send customized error response not working per requirement.

i using error-channel accomplish above requirement not succeeding in that.

please find configuration of in-bound gateway, error channel etc. have not use chain in configuration.

<int-http:inbound-gateway id="inboundgateway"     supported-methods="get, post" request-channel="requestchannel"     path="/services/tylv/{requestparam}" reply-channel="responsechannel"     error-channel="errorchannel"> </int-http:inbound-gateway>  <int:transformer ref="errorhandler"  input-channel="errorchannel" method="generateerrorresponse"  output-channel="responsechannel" />  <bean id="errorhandler"     class="com.csam.wsc.enabling.integration.transformer.errorhandler" /> 

in case of exception , com.csam.wsc.enabling.integration.transformer.errorhandler.generateerrorresponse(errormessage) called.this api handle exceptions, generate error response packet not being sent client, http status code 200 sent.

ideally should sent because transformer's output-channel reply-channel of inbound-gateway sending response packet along status code 200 in case of success (no exception).

i think in case of error-channel , in-bound gateway reply-channel not working, not sure.

please me in configuring error-channel.

you should store message's headers before error reaches error channel , should create new message stored headers , route new message response channel.

messagebuilder.frommessage(errorresponsemessage).copyheadersifabsent(storedheaders).build(); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -