Spring SFTP inbound chanel adapter delete local file

懵懂的女人 提交于 2019-12-02 10:15:49

Inbound adapters never take any action (on their own) after the message is sent to the flow; it doesn't know anything about the downstream flow topology - async handoffs etc. The remote deletion is done after the file is fetched and before the message is sent.

Since you're already using a pseudo transaction, and doing everything on the poller thread, you can do the delete with an after-commit-expression.

The other technique is to add a request-handler-advice to the final consumer (service activator in your case). That is demonstrated in the retry-and-more sample app.

EDIT:

In response to your comments below; no it's not possible to do 2 things with SpEL - however, you can use

<int:after-commit expression="payload" channel="postProcess"/>

and do whatever you want on the flow downstream of the postProcess channel.

However, it's not clear to me why you want to remove the file from the filter for both success and failure - you should just use an AcceptAllFileListFilter instead.

By the way, I don't see your acceptOnceFilter being used anywhere here - did you intend to configure it into the local-filter attribute?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!