title: Apache Camel - Pass Filename from route1 to route2 which FTPs
body: <p>I have a requirement of generating a file from webservice and FTP to a location.</p>
  
  <p>Route1:</p>
  
  <pre><code>from("direct:start")
      .routeId("generateFileRoute")
      .setHeader(Exchange.HTTP_METHOD, constant("GET"))
      .setHeader(Exchange.HTTP_URI, simple(URL))
      .setHeader("Authorization", simple(APP_KEY))
      .to(URL)
      .unmarshal(listJacksonDataFormat)
      .marshal(bindyCsvDataFormat)
      .to(fileDirLoc + "?fileName=RMA_OUT_${date:now:MMddyyyy_HHmmss}.csv&amp;noop=true");  
  </code></pre>
  
  <hr/>
  
  <p>Route 2: FTP Route</p>
  
  <pre><code>from("file://"+header("CamelFileNameProduced"))
      .routeId("ftpRoute")
      .to("sftp://FTP_HOST/DIR?username=???&amp;password=???)
  </code></pre>
  
  <p>To start the route</p>
  
  <pre><code>Exchange exchange = template.request("direct:start", null);
  
  Object filePathObj = exchange.getIn().getHeader("CamelFileNameProduced");
  
  if (filePathObj != null) { // Makesure Route1 has created the file
      camelContext.startRoute("ftpRoute");     // Start FTP route
      template.send(exchange); // Send exchange from Route1 to Route2
  }
  </code></pre>
  
  <p>The above code worked when I hard-coded the location in FTP route.
  Can someone please help, how can I pipeline these 2 routes and pass output of Route 1 ("File Name") to Route2 for FTP?</p>