title: Spring Integration: How to send response packet to client in case of exception using error-channel?
body: <p>I am using Spring Integration in my project.
  Endpoints used in application are in-bound gateway, header based router, transformer, spliter, service activator.</p>
  
  <p>In case of success flow(not any exception), in-bound gateway <strong>reply-channel</strong> getting desired response and client gets that response which is fine but in case of any exception, I want to send customized error response which is not working as per my requirement.</p>
  
  <p>I am using error-channel to accomplish above requirement but not succeeding in that. </p>
  
  <p>Please find my configuration of in-bound gateway, error channel etc.
  I have not use any chain in configuration.</p>
  
  <pre><code>&lt;int-http:inbound-gateway id="inboundGateway"
      supported-methods="GET, POST" request-channel="requestChannel"
      path="/services/tylv/{requestParam}" reply-channel="responseChannel"
      error-channel="errorChannel"&gt;
  &lt;/int-http:inbound-gateway&gt;
  
  &lt;int:transformer ref="errorHandler"
   input-channel="errorChannel" method="generateErrorResponse"
   output-channel="responseChannel" /&gt;
  
  &lt;bean id="errorHandler"
      class="com.csam.wsc.enabling.integration.transformer.ErrorHandler" /&gt;
  </code></pre>
  
  <p>In case of exception , com.csam.wsc.enabling.integration.transformer.ErrorHandler.generateErrorResponse(ErrorMessage) successfully called.This API handle exceptions, generate Error Response Packet but it is not being sent to client, just only HTTP Status Code 200 sent.</p>
  
  <p>Ideally it should be sent because transformer's output-channel is reply-channel of inbound-gateway which is already sending response packet along with status code 200 in case of success (no any exception).</p>
  
  <p>I think in case of error-channel , in-bound gateway reply-channel is not working, but I am not sure.</p>
  
  <p>Please help me in configuring error-channel.</p>