具有当前日期的 Apache 骆驼文件名



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

我的应用程序中有以下内容.yaml

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

这是抛出的异常。

 java.nio.file.InvalidPathException: Illegal char <:> at index 11: H:tempnow:yyyyMMdd

我想输出如下内容

some_file_name_20190717.csv

如何让骆驼评估表达式${date:now:yyyyMMdd}

您可以更新属性文件中的某些内容,例如:

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

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

在爪哇路由中

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

在应用程序中.yaml

destination-end-point-file: file:/H:/temp

最新更新