キャメル ルートで ftp ファイルを処理するための型変換に苦労しています。私のルートは次のようになります(Spring DSL):
<route id="processIncomingFtpFile" errorHandlerRef="parkingCitErrHandler">
<from uri="{{ftp.parkingcit.input.path}}"/>
<bean ref="ftpZipFileHandler"/>
<unmarshal ref="bindyCsvFormat"/>
<bean ref="parkingTicketsHandler"/>
<split>
<simple>${body}</simple>
<marshal ref="jaxbFormatter"/>
<convertBodyTo type="java.io.File"/>
<to uri="{{ftp.parkingcit.output.path}}"/>
</split>
</route>
そして、私のハンドラー署名は次のようになります。
public File handleIncomingFile(File incomingfile)...
ただし、これにより、次の型変換の問題が発生します。
org.apache.camel.InvalidPayloadException: No body available of type: java.io.File but has value: RemoteFile[test.zip] of type: org.apache.camel.component.file.remote.RemoteFile on: test.zip. Caused by: No type converter available to convert from type: org.apache.camel.component.file.remote.RemoteFile to the required type: java.io.File with value RemoteFile[test.zip]. Exchange[test.zip]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: org.apache.camel.component.file.remote.RemoteFile to the required type: java.io.File with value RemoteFile[test.zip]]
私の質問は次のとおりです。キャメルにディスクに書き込むように明示的に指示せずに、ftp ファイルをメモリ内で処理できるようにする必要がありますか? それとも、ハンドラーが入力パラメーターとして java.io.File を必要としている場合、つまり、これが機能するためにデータをディスクに書き込む必要がある場合、私がやろうとしていることは無意味ですか?