Move file with file-adapter Hi I'd like to move file in sucess folder after it'is consumed or in failed folder when there is the problem.
Around I found different example but I could not figure out an easy solution to move file with file-adapter
Probably I have problem in using Spring Expression Language but if i use
<int:poller default="true" fixed-delay="50"/>
<bean id="pseudoTransactionManager" class="org.springframework.integration.transaction.PseudoTransactionManager" />
<int:channel id="committedChannel"/>
<int:channel id="rolledBackChannel"/>
<int-file:inbound-channel-adapter channel="input" directory="target/input" filename-pattern="*">
<int:poller fixed-rate="500">
<int:transactional transaction-manager="pseudoTransactionManager" synchronization-factory="syncFactory" />
</int:poller>
</int-file:inbound-channel-adapter>
<int:transaction-synchronization-factory id="syncFactory">
<int:after-commit expression="payload.renameTo('/success/' + payload.name)" channel="committedChannel" />
<int:after-rollback expression="payload.renameTo('/failed/' + payload.name)" channel="rolledBackChannel" />
</int:transaction-synchronization-factory>
<int:service-activator input-channel="input" ref="sampleEndpoint" output-channel="output"/>
<int:channel id="output"/>
<int-file:outbound-channel-adapter channel="output" directory="target/output"/>
I retrive the following error
Method call: Method renameTo(java.lang.String) cannot be found on java.io.File type correctly
that is correct cause the method doesn't exists
if i use payload.remove() I remove file not move. if I don't use remove file it is not remove from src
I think that it's a dummy configuration or a simple use of SpEL but ... I can't figure out a linear solution
Thanks
martin