这是我之前问题的延伸 How to upload multiple files via REST over HTTP using Mule? .要求说,必须在每周三上午 10 点上传文件。从今以后,我需要一个调度程序来完成这个。我发现解决方案是使用 Cron Expression 的“Quartz”入站组件。
但是我该怎么做呢?因为我不能有两个“入站端点”。( quartz 和文件)例如
<flow name="fileUploader" doc:name="fileUploader">
<quartz:inbound-endpoint
jobName="myServiceJob"
repeatInterval="5000"
cronExpression="0 0 10 ? * WED
doc:name="Quartz">
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
<file:inbound-endpoint
path="C:\input"
pollingFrequency="5000" moveToDirectory="C:\movehere" doc:name="File"
responseTimeout="10000"/>
<object-to-byte-array-transformer doc:name="Object to Byte Array"/>
<file:outbound-endpoint
path="C:\outputfile"
responseTimeout="10000"
doc:name="File"/>
</flow>
如果我运行我得到错误
线程“main”中的异常 org.mule.module.launcher.DeploymentInitException:SAXParseException:cvc-complex-type.2.4.a:发现以元素“file:inbound-endpoint”开头的无效内容。强>
那么我需要做什么改变呢?
请帮忙
最佳答案
试试这个
<file:endpoint name="fileConnector" path="C:\input" pollingFrequency="5000" doc:name="File"/>
<flow name="fileUploader" doc:name="fileUploader">
<quartz:inbound-endpoint
jobName="myServiceJob"
repeatInterval="5000"
cronExpression="0 0 10 ? * WED"
doc:name="Quartz">
<quartz:endpoint-polling-job>
<quartz:job-endpoint ref="fileConnector"/>
</quartz:endpoint-polling-job>
</quartz:inbound-endpoint>
<file:outbound-endpoint
path="C:\outputfile"
responseTimeout="10000"
outputPattern="#[message.inboundProperties.originalFilename]"
doc:name="File"/>
</flow>
关于mule - 如何使用将定期调用文件 uploader 的 Quartz 组件安排服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14478401/