2014-07-03 107 views
0

基於FTP2組件,路由定義很簡單。來自駱駝交換體的文件對象在駱駝FTP中爲空

 Endpoint[sftp://server.com:22//path/to/file/?consumer.delay=900000&password=xxxxxx&username=user] 

我想從FTP文件夾讀取文件。

JAXBContext jaxBContext = JAXBContext.newInstance(ObjectFactory.class); 
    Unmarshaller unmarshaller = jaxBContext.createUnmarshaller(); 
    File authBatchFile = exchange.getIn().getBody(File.class); 
    AuthorizationFeed batchAuthFeed = (AuthorizationFeed) JAXBIntrospector 
      .getValue(unmarshaller.unmarshal(authBatchFile)); 

交換的一切它應該有

Body    [Body is file based: RemoteFile[fileName.txt]] 

頁眉也顯示了文件CamelFileLength = 81612的大小。但是,在交換跟蹤之後,我收到了下面的異常。

java.lang.IllegalArgumentException: The value for the "java.io.File" parameter cannot be null. 
at com.ibm.xml.xlxp2.jaxb.unmarshal.AbstractUnmarshallerImpl.reportNullParameter(AbstractUnmarshallerImpl.java:180) 
at com.ibm.xml.xlxp2.jaxb.unmarshal.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:72) 
at com.wellpoint.clihub.hie.um.camel.processor.BatchCFFProcessor.process(BatchCFFProcessor.java:47) 

回答

0

我找到了解決方案,它通過向路由定義

&localWorkDirectory=/tmp. 

這樣,它不認爲這是一個遠程文件,並認爲它是一個 java.io .File。我認爲在處理遠程文件時,駱駝應該將其作爲默認功能。根據他們的文檔,

上面的路由是超高效的,因爲它避免了將整個文件內容讀入內存。它會將遠程文件直接下載到本地文件流中。然後將java.io.File句柄用作Exchange主體。