我想从与这样的正则表达式对应的文件夹中读取文件
from("direct:queuealpha").process(new DateTagGenerator()).from("file:///folder1/folder2/?delete=false&include=.*(${headers.timetag}).*);
因此 DateTagGenerator 设置一个 header ,其中包含我想在正则表达式中用作输入的值。我尝试逃跑{, $ and }
以及使用简单但我显然做错了。
如何动态创建 header 或正文的值,然后将其用于正则表达式?
最佳答案
自 Camel 2.16 起,您可以将内容丰富器与动态端点 ([doc][1]) 一起使用,特别是 pollEnrich
(因为您使用的是 文件
端点)
from("direct:queuealpha")
.process(new DateTagGenerator())
.pollEnrich.simple("file:/folder1/folder2/?delete=false&include=${headers.timetagExpr}")
.process(…) // you can now process the message
.to(…); // and send it onward
关于java - apache Camel 正则表达式中的 header 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38459921/