代码之家  ›  专栏  ›  技术社区  ›  Jigar Naik

当前日期为的Apache camel文件名

  •  0
  • Jigar Naik  · 技术社区  · 5 年前

    是否可以在camel文件目标端点中提供包含日期的动态文件名?

    以下是我的申请表

    destination-end-point-file: file:/H:/temp?fileName=${date:now:yyyyMMdd}
    

     java.nio.file.InvalidPathException: Illegal char <:> at index 11: H:\temp\now:yyyyMMdd
    

    我想输出如下

    一些文件名

    如何使camel求值表达式 ${date:now:yyyyMMdd}

    1 回复  |  直到 5 年前
        1
  •  0
  •   Jigar Naik    5 年前

    我可以通过在java route中添加表达式来实现它,但我不确定它为什么在从spring属性文件读取时不计算表达式。

    在Java路由中

    .to("{{tp.position.destination-end-point-file}}" + "?fileName=ps_open_txn_batch_${date:now:yyyyMMdd}.csv")
    

    应用中.yaml

    destination-end-point-file: file:/H:/temp
    
        2
  •  0
  •   Matthew Kerian    5 年前

    tp.position.destination-end-point-file=file:/output/location? 
    fileName=ps_open_txn_batch_$simple{date:now:yyyyMMdd}.csv