我想在代码下面创建两个具有相同名称但扩展名不同的文件,我可以在其中创建文件 abc.dat
同时我想创建另一个文件 ex
abc.txt
与 abc.dat
相同的位置将为空:
from("file:C:\\input?filter=#testFilter").split(body().tokenize("\n")).
streaming().setHeader(Exchange.FILE_NAME,simple(newFileName+".dat")).bean(LineParser.class, "process").to("file:C:\\output"+ Constants.getMapping().get(argumentName)+"?fileExist=Append");
提前致谢。
最佳答案
要在同一目录中创建第二个空文件,请在 camel file language 的帮助下使用 donefileName
选项(需要toD)。
from("file:C:\\input?filter=#testFilter")
.split(body().tokenize("\n"))
.streaming()
.setHeader(Exchange.FILE_NAME,simple(newFileName+".dat"))
.bean(LineParser.class, "process")
.toD("file:C:\\output"+ Constants.getMapping().get(argumentName)+"?fileExist=Append&donefileName=${file:name.noext}.txt")
附: ${file:name.noext}
表示数据文件名中的 abc
部分 abc.txt
关于java - Apache Camel 创建两个具有相同名称但扩展名不同的单独文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53046998/