title: Camel route, how to use an Endpoint as a trigger, returning an immediate response but continuing with the process?
body: <p>I want to use Camel to implement a kind of trigger EIP.</p>
  
  <p>What I want is this:
  I have a web service that will act as a camel-route endpoint. This service receives a request and if the request is well-formed it must do two things in parallel:
  return a response to the original sender with a simple message "OK" or "ACK" or in case of the request not being well-formed the response will be "NOK" or "RPT" (asking to repeat the message).
  then at the same time, if the message is well-formed it must be sent to another web-service that will enrich the original message with some info and send the resulting Message (or Exchange, I'm not sure of the right term here) to a JMS implementation.</p>
  
  <p>My endpoint acts as the trigger for a process but must return a response right away to the caller.</p>
  
  <p>So my question is, what component can I use to do this? I'm implementing the route with Spring DSL.
  I started by using:</p>
  
  <pre><code>&lt;route&gt;
    &lt;from uri="cxf:bean:clientEventEip?dataFormat=MESSAGE"/&gt;
    &lt;multicast&gt;
      &lt;to uri="bean:messageResponse"/&gt;&lt;!-- checks the message and returns 'OK' --&gt;
      &lt;to uri="bean:messageEnricher"/&gt;&lt;!-- Enriches and sends msg to another WS --&gt;
    &lt;/multicast&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>But I'm getting an error response in the client:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soap:Body&gt;
        &lt;soap:Fault&gt;
           &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
           &lt;faultstring&gt;Exception occurred during execution on the exchange: Exchange[Message: [Body is instance of java.io.InputStream]]&lt;/faultstring&gt;
        &lt;/soap:Fault&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>and in the IDE a lot of exceptions like:</p>
  
  <pre><code>org.apache.camel.CamelExecutionException
  </code></pre>
  
  <p>and</p>
  
  <pre><code> org.apache.camel.InvalidPayloadException: No body available of type: org.w3c.dom.Document but has value: org.apache.cxf.transport.http.AbstractHTTPDestination$1@b8c6fb of type: null on: Message: [Body is instance of java.io.InputStream]. Caused by: Error during type conversion from type: null to the required type: org.w3c.dom.Document with value org.apache.cxf.transport.http.AbstractHTTPDestination$1@b8c6fb due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.. Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by: [org.apache.camel.TypeConversionException - Error during type conversion from type: null to the required type: org.w3c.dom.Document with value org.apache.cxf.transport.http.AbstractHTTPDestination$1@b8c6fb due org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.]
  </code></pre>
  
  <p>If I just use one of the beans in my camel route all goes well, the response is the one I expect.</p>
  
  <p>I'm sure that it's my mistake, I must be using the wrong component but I still haven't figured out how so solve this, I appreciate any help anyone can give me!</p>