5.10. MoveAfterRead consumer 选项
除了删除AfterRead它外,还添加了另一个选项,请 moveAfterRead。启用此选项后,消耗的对象将移到目标目标Bucket 中,而不是只删除。这将需要指定 destinationBucket 选项。例如:
from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket") .to("mock:result");
在这种情况下,所使用的对象将移到 myothercamelbucket 存储桶并从原始对象中删除(因为 deleteAfterRead 设为 true 为默认值)。
您还可以在将文件移动到不同的存储桶时使用密钥前缀/suffix。这些选项是 destinationBucketPrefix 和 destinationBucketSuffix。
使用以上示例,您可以执行以下操作:
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 的文件。