This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

ftp-outbound-adapter interceptor

Feb 23rd, 2011, 07:54 AM

Hi all,
I'm using ftp-outbound-adapter to send ftp file on a remote directory. I need to update a table into the DB only if the file is successfully sent. How to?
Channel interceptor, if I understand it correctly, doesn't resolve this use case.

Well, you CAN use channel interceptor (postSend) for now, however i would clearly state that it would be a temporary workaround.
What we need to do is expose ftp:outbound-gateway. This would allow us to generate a response (e.g., ftp status code) which you can use to determine what further action should be taken (in your case you would do a write to a db).

Could you please create an feature request in JIRA https://jira.springsource.org/browse/INT (if you don't have an account create one). This way you'd be notified when it is done, or let us know and we create one for you and you can add yourself as a watcher.
Cheers

Comment

You can also consider ordered subscribers to a <publish-subscribe-channel/>, as long as the channel is synchronous, or runs with an executor with a single thread, the second consumer (by default) will only receive the message if the first consumer is successful.

Comment

you can set the "failover" flag to false, on the consumer channel.
In this way, all Exceptions will be throws out ftp-outbound-adapter by the client. (eg access failed, banned server ..)
Then you can resolved with simple try-catch block on client.