Using spring integration, I want to pickup only the files based from the filename specified by a trigger file.
E.g. batch01.tar will be picked up if .batch01-trigger is present then update the filename of the trigger depending on the processing outcome (.batch01-trigger.success or .batch01-trigger.failed)
I am polling S3 bucket at the moment but I couldn't apply the above use case.
Thanks!
I used AWS SDK and spring-integration-aws.
I can see a solution like this:
Have an
S3InboundFileSynchronizingMessageSourceconfigured for the*-triggerpattern. So, it is going to poll S3 directory periodically for presence of the files like yours.batch01-trigger.You send this file downstream to some service activator which would use an
S3Session.list()and filter out only matching files. Orpublic InputStream readRaw(String source) {since you know at this point the file name (batch01.tar) you need to pull from an S3.The trigger file you store in the message headers at this point.
After processing
.tarfile you make a.successor.faileddecision and performS3Session.rename().