6.10. MoveAfterRead consumer オプション
deleteAfterRead に加えて、moveAfterRead という別のオプションが追加されました。このオプションを有効にすると、消費されたオブジェクトは削除されるだけでなく、ターゲットの destinationBucket に移動されます。これには、destinationBucket オプションを指定する必要があります。例として:
from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket") .to("mock:result");
from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket")
.to("mock:result");
この場合、消費されたオブジェクトは myothercamelbucket バケットに移動され、元のバケットから削除されます (deleteAfterRead がデフォルトで true に設定されているため)。
ファイルを別のバケットに移動するときに、キーの接頭辞/接尾辞を使用することもできます。オプションは、destinationBucketPrefix と destinationBucketSuffix です。
上記の例を取ると、次のようなことができます。
from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket&destinationBucketPrefix=RAW(pre-)&destinationBucketSuffix=RAW(-suff)") .to("mock:result");
from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket&destinationBucketPrefix=RAW(pre-)&destinationBucketSuffix=RAW(-suff)")
.to("mock:result");
この場合、消費されたオブジェクトは myothercamelbucket バケットに移動され、元のバケットから削除されます (deleteAfterRead がデフォルトで true に設定されているため)。
したがって、ファイル名が test の場合、myothercamelbucket に pre-test-suff というファイルが表示されます。