6.10. MoveAfterRead 소비자 옵션
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 버킷으로 이동하여 원래 버킷에서 삭제됩니다(삭제AfterRead가 기본값으로 설정되었기 때문에).
또한 파일을 다른 버킷으로 이동하는 동안 키 접두사/suffix를 사용할 수 있습니다. 옵션은 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 버킷으로 이동하여 원래 버킷에서 삭제됩니다(삭제AfterRead가 기본값으로 설정되었기 때문에).
따라서 파일 이름이 test인 경우 myothercamelbucket에 pre-test-suff라는 파일이 표시되어야 합니다.