title: Can I Message Spring Integration Channel from within My Inbound Channel Adapter Handler?
body: <p>I'm looking to message another channel, if certain conditions merit, from within the handler of my file inbound-channel-adapter. Sometimes the inbound file has out of specification values and I'd like to send the file to an error directory, but not interrupt the flow of the inbound to outbound since even the out of specification file still needs to goto a secondary location.</p>
  
  <p>Example of my configuration:</p>
  
  <pre><code>&lt;int-file:inbound-channel-adapter id="filesIn"
                                    directory="${input.path}"
                                    filename-regex="\\d{8}-\\d+\\.txt"&gt;
      &lt;int:poller id="poller" fixed-rate="500"/&gt;
  &lt;/int-file:inbound-channel-adapter&gt;
  
  &lt;int-file:file-to-string-transformer input-channel="filesIn"
                                       output-channel="strings"
                                       delete-files="true" /&gt;
  
  &lt;int:channel id="strings"/&gt;
  &lt;int:channel id="errorChannel" /&gt;
  
  &lt;int:exception-type-router input-channel="strings"
                             default-output-channel="output"&gt;
      &lt;int:mapping exception-type="ca.uhn.hl7v2.HL7Exception"
                   channel="errorChannel"/&gt;
  &lt;/int:exception-type-router&gt;
  
  &lt;int:service-activator input-channel="output"
                                 output-channel="archive"
                                 ref="handler" method="handleString"/&gt;
  
  &lt;int:service-activator input-channel="errorChannel"
                         output-channel="errorOutput"
                         ref="handler" method="handleError" /&gt;
  
  &lt;int-file:outbound-channel-adapter id="archive"
                                     directory="${archive.path}"
                                     delete-source-files="true"/&gt;
  
  &lt;int-file:outbound-channel-adapter id="errorOutput"
                                     directory="${hl7.error.path}"/&gt;
  
  &lt;bean id="handler" class="com.giotta.service.Hl7MessageConsumer"/&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/F45Ts.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F45Ts.png" alt="Crude Diagram"></a></p>