title: Camel CXF asynchronous request and reply
body: <p>I would like to set up a Camel CXF endpont, and have the SOAP response asynchronous to much of my Camel Route. The route will have a lot of processing steps, and I do not want to have the response generated at the very end.</p>
  
  <p>An example endpoint:</p>
  
  <pre><code>&lt;cxf:cxfEndpoint id="someEndpoint"
                       address="/Service"
                       serviceClass="com.SomeImpl" /&gt;
  </code></pre>
  
  <p>An example route:</p>
  
  <pre><code>public class MyRouteBuilder extends RouteBuilder {
      @Override
      public void configure() throws Exception {
          from("cxf:bean:someEndpoint")
          to("bean:processingStep1")
          to("bean:replyToSOAP")  // I would like to respond to cxf:cxfEndpoint here!
          to("bean:processingStep2")
          to("bean:processingStep3")
          to("bean:processingStep4");
          // The response to cxf:cxfEndpoint actually happens here.
      }
  }
  </code></pre>
  
  <p>I have tried many options in MyRouteBuilder to "fork" the process (i.e. bean:replyToSOAP):</p>
  
  <ol>
  <li>.multicast().parallelProcessing()</li>
  <li>In-memory Asynchronous messaging ("seda" and "vm")</li>
  <li>I have NOT tried JMS. It could be overkill for what I want to do.</li>
  </ol>
  
  <p>I can get the route steps to process in parallel, but <strong>all</strong> steps must be completed before the response is generated.</p>
  
  <p>In addition to the answer Claus gives below, I'd like to add that the placement of wireTap is important. Using:</p>
  
  <pre><code>.wireTap("bean:replyToSOAP")
  </code></pre>
  
  <p>will not get the desired behavior. What will is:</p>
  
  <pre><code>public class MyRouteBuilder extends RouteBuilder {
      @Override
      public void configure() throws Exception {
          from("cxf:bean:someEndpoint")
          to("bean:processingStep1")
          .wireTap("direct:furtherProcessing")
          to("bean:replyToSOAP")  // respond to cxf:cxfEndpoint here
  
          from("direct:furtherProcessing") // steps happen independantly of beann:replyToSOAP 
          to("bean:processingStep2")
          to("bean:processingStep3")
          to("bean:processingStep4");
      }
  }
  </code></pre>