我必须根据标头属性将文件写入多个子目录。没有办法在 Spring Integration 中配置它。
@Bean
@ServiceActivator(inputChannel = "processingChannel")
public MessageHandler processingDirectory() {
FileWritingMessageHandler handler = new FileWritingMessageHandler(new File("some-path"));
handler.setFileExistsMode(FileExistsMode.REPLACE);
handler.setExpectReply(false);
handler.setPreserveTimestamp(true);
handler.setTemporaryFileSuffix(".writing");
handler.setAutoCreateDirectory(true);
return handler;
}
这个 bean 接收一个文件以及一些标题属性,即来自 "processingChannel" 的 type="abc" 。文件已成功写入某个路径。但我的要求是根据“类型”值写入 somepath/abc 或 somepath/xyz 位置