title: Sending message to reply-channel of http-inbound-gateway
body: <p>I have a below setup with spring integration.</p>
  
  <pre><code>&lt;int-http:inbound-gateway id="restListener"
                            request-channel="restChannel"
                            reply-channel="restResponseChannel"
                            path="/service"
                            supported-methods="POST"
                            reply-timeout="5000"
  &lt;/int-http:inbound-gateway&gt;
  
  
  
  &lt;int:channel id="restChannel"/&gt;
  &lt;int:channel id="restResponseChannel"/&gt;
  
  &lt;int:service-activator input-channel="restChannel"
                         ref="restRequestHandler"
                         method="handleRestRequest"/&gt;
  </code></pre>
  
  <p>I receive 2 different types of POST requests on gateway and both of them are passed to <code>service-activator</code> for processing. In one type of POST request my <code>service-activator</code> can immediately process it and reply back with a standard response. However, other type of request will be routed through different channels and processed by different processors (depending on the content). I want the output for processing both type of requests to be sent as <code>response</code> of REST call.</p>
  
  <p>For first type of request I can simply do this</p>
  
  <pre><code>public void handleRestRequest(Message&lt;JsonNode&gt; postMessage) {
       if (type1) {
          // Do processing
          restResponseChannel.send(MessageBuilder
                  .withPayload("{\"result\":\"success!\"}")
                  .copyHeaders(postMessage.getHeaders())
                  .build());
       } else {
          // send to another channel for further processing
       }
  
  }
  </code></pre>
  
  <p>But for second type of request if I try to <code>send</code> my output to <code>restResponseChannel</code> (without headers) then I get below exception</p>
  
  <blockquote>
    <p>org.springframework.messaging.core.DestinationResolutionException: no
    output-channel or replyChannel header available</p>
  </blockquote>
  
  <p>I do not have access to original headers for second type of request. How can I send the output to <code>reply-channel</code>? (I read somewhere that gateway creates an anonymous channel to connect to the <code>reply-channel</code> and not having those headers is causing the exception, however I don't understand the underlying mechanism completely to debug this myself)</p>