【问题标题】:header value in regex expression for apache camel [duplicate]apache camel的正则表达式中的标头值[重复]
【发布时间】:2016-07-19 13:24:07
【问题描述】:

我想从对应于这样的正则表达式的文件夹中读取文件

from("direct:queuealpha").process(new DateTagGenerator()).from("file:///folder1/folder2/?delete=false&include=.*(${headers.timetag}).*);

所以 DateTagGenerator 使用我想在正则表达式中使用的值设置一个标题作为输入。我尝试转义 {, $ and } 以及使用 simple 但我显然做错了。

如何为标题或正文动态创建一个值,然后将其用于正则表达式?

【问题讨论】:

    标签: java apache-camel


    【解决方案1】:

    从 Camel 2.16 开始,您可以将 Content Enricher 与动态端点 ([doc][1]) 一起使用,尤其是 pollEnrich(因为您使用的是 file 端点)

    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
    

    【讨论】:

    • 刚刚在 SO 上看到了一个副本……我还是把答案留在这里
    猜你喜欢
    • 2023-03-18
    • 1970-01-01
    • 2019-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-26
    • 1970-01-01
    相关资源
    最近更新 更多