315.4. Aggregate
INFO:Please note. this aggregation strategy requires that this aggregation completion check to work correctly.
この例では、入力ディレクトリーにあるすべてのテキストファイルを、output ディレクトリーに保存される単一の Tar ファイルに統合します。
from("file:input/directory?antInclude=*/.txt")
.aggregate(new TarAggregationStrategy())
.constant(true)
.completionFromBatchConsumer()
.eagerCheckCompletion()
.to("file:output/directory");
発信 CamelFileName メッセージヘッダーは、java.io.File.createTempFile と ".tar" 接尾辞を使用して作成されます。 この動作をオーバーライドする場合は、ルートに CamelFileName ヘッダーの値を明示的に設定できます。
from("file:input/directory?antInclude=*/.txt")
.aggregate(new TarAggregationStrategy())
.constant(true)
.completionFromBatchConsumer()
.eagerCheckCompletion()
.setHeader(Exchange.FILE_NAME, constant("reports.tar"))
.to("file:output/directory");