I'm working on a simple spring-integration project that selects some files (using file:inbound-channel-adapter) and based on those files imports some data into DB.
At the end it would like to have those files deleted as I no longer need them and so far I haven't figured out how to do that without coding.
file:outbound-channel-adapter is no go as it moves files instead of deleting them.
I'm trying to solve it with
<int:outbound-channel-adapter expression="headers['file_originalFile'].delete()" ...
But I'm getting
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Void';
Do you have any ideas how to solve it without coding?
File.delete() returns a boolean and, by contract, an outbound channel adapter MUST return void (no output).
You can use a <service-activator/> with output-channel="nullChannel" to discard the result.
Or, you can use an expression evaluating advice on your ultimate consumer, as shown in the retry-and-more sample.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With