mule - 如何使用将定期调用文件 uploader 的 Quartz 组件安排服务?

标签 mule mule-studio

这是我之前问题的延伸 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/

相关文章:

mule - 远程 jprofiler 与 mule 的集成

Mule 属性窗口未显示

mule - 为什么使用 Maven 构建 Mule Studio 3.4 失败或无限期挂起

xml - 骡子相同的有效载荷在不同的条件下以不同的格式显示在记录器中

mule - 在 Mule 中使用 Choice Router 的优点和缺点

java - 在 Mule 中触发模拟 quartz 端点

java - Mule 如何处理不符合其 XML 模式的 XML 配置?

java - Heroku 和 Mule

scope - java代码mule中访问流变量

mysql - 在 Mule 中插入大量记录时发生错误如何回滚数据库更改?