我正在创建一个文件传输路径,move
用于设置文件传输成功后移动文件的动态路径。我还设置了一个通知程序来跟踪文件传输事件。
由于移动路径是动态的,我需要获取文件传输后文件移动的评估路径。这个路径怎么能在notifier里面呢?
public class MyFtpServiceBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
getContext()
.getManagementStrategy()
.addEventNotifier(new MyFtpServiceNotifier());
from("file:C:/tmp/inputfolder?move=archive/${date:now:yyyyMMdd}/${file:onlyname}")
.routeId("myRoute")
.to("file:C:/tmp/outputfolder")
}
}
public class MyFtpServiceNotifier extends EventNotifierSupport {
@Override
public void notify(EventObject event) throws Exception {
Exchange exchange = ((AbstractExchangeEvent) event).getExchange();
if (event instanceof ExchangeSentEvent) {
// Want to get here the path where file was moved
}
}
@Override
public boolean isEnabled(EventObject event) {
return event instanceof AbstractExchangeEvent;
}
}