1

データベーステーブルを読み取って絶対ファイルパスのリストを取得し、それらのファイルを別のフォルダーにコピーするキャメルルートを作成しようとしています。ただし、元のコンテンツではなく、ファイル パスのみがコンテンツとして作成されます。

    from("timer://testDataGen?repeatCount=1")
    .to("sql:" + positionSql + "?dataSource=dataSource")
    .split(body())
    .to("file://" + positionlistDir )
    .log("Finished copying the list of Files.")

絶対ファイルパスを実際のファイルに変換するために、ここで何が欠けているのか教えてください。

更新 #1。

以下のスニペットは、pollEnrich() を呼び出しています。しかし、代わりに pollEnrich() は、以前の交換のファイル名に従ってではなく、SQL によって返された行の数に等しいファイルの数をコピーしています。

        String positionListSqlOptions = "?dataSource=dataSource";
//      String positionSrcDirOptions = "?noop=true&delay=500&readLockMarkerFile=false&fileName=${header.positionFileToBeCopied}";
        String positionSrcDirOptions = "?noop=true&delay=500&readLockMarkerFile=false&fileName=${body}";
        String positionStagingDirOptionsForWriting = "?doneFileName=${file:name}.DONE";

        from("timer://testDataGen?repeatCount=1")
        .to("sql:" + positionListSql + positionListSqlOptions)
        .split(body())
        \\ Getting the column value from the resultset which is a LinkedCaseInsensitiveMap and storing in the body
        .process(new positionFeederProcessor()) 
        .setHeader("positionFileToBeCopied", body())
        .pollEnrich("file://" + positionSrcDir + positionSrcDirOptions)
//      .pollEnrich().simple("file://" + positionSrcDir + positionSrcDirOptions)
        .to("file://" + positionStagingDir + positionStagingDirOptionsForWriting)
        .log("Finished copying the list of Files.");

pollingEnrich() エンドポイントに渡された実際のファイル名をまだ取得できません。ヘッダーからだけでなく、本文からも抽出してみました。何がうまくいかなかったのでしょう。

4

2 に答える 2