【发布时间】:2017-08-03 08:29:15
【问题描述】:
我正在尝试制作一个文件出站通道适配器来写入一个将上次修改日期属性设置为自定义值而不是系统当前时间的文件。
根据文档 (http://docs.spring.io/spring-integration/docs/4.3.11.RELEASE/reference/html/files.html#file-timestamps),我应该在出站上将preserve-timestamp 属性设置为true,并将标头file_setModified 设置为消息中所需的时间戳。
反正我试了几次都没有成功。
这是一个代码 sn-p 来显示我现在在做什么:
<int:inbound-channel-adapter
channel="msg.channel"
expression="'Hello'">
<int:poller fixed-delay="1000"/>
</int:inbound-channel-adapter>
<int:header-enricher
input-channel="msg.channel"
output-channel="msgEnriched.channel">
<int:header
name="file_setModified"
expression="new Long(1473897600)"/>
</int:header-enricher>
<int-file:outbound-channel-adapter
id="msgEnriched.channel"
preserve-timestamp="true"
directory="/tmp/foo"/>
这有什么问题?
(使用 Spring Integration 4.3.11)
【问题讨论】: