【问题标题】:Mule file inbound connector with poll scope具有轮询范围的 Mule 文件入站连接器
【发布时间】:2017-05-20 05:01:07
【问题描述】:

我正在尝试将 mule 入站文件连接器与 poll 范围一起使用,但出现错误说无法启动端点。如果我删除轮询范围并使用带有默认轮询的文件连接器并且它工作正常而没有任何文件路径更改。

我想知道为什么轮询范围会出错?如果文件入站连接器不允许包含在轮询范围中,为什么 anypoint studio 在选项中显示轮询范围?

我找到了类似的问题,但我没有看到详细的解释。

Mule won't allow POLL message processor to read file using file Inbound?

提前感谢您的回复。

【问题讨论】:

    标签: mule mule-esb


    【解决方案1】:

    将 mule-module-requester https://github.com/mulesoft/mule-module-requester 与 Poll Scheduler 一起使用。

    相关帖子:http://blogs.mulesoft.com/dev/mule-dev/introducing-the-mule-requester-module/

    另一种方法是,

    设置 FTP 流程 initialState="stopped",并让轮询调度程序启动流程。 FTP处理完毕后,再次停止流。

    查看示例代码:

    <ftp:connector name="FTP" pollingFrequency="1000"
         validateConnections="true" moveToDirectory="/work/ftp/processed"
         doc:name="FTP" />
     <flow name="scheduleStartFTPFlow">
         <poll doc:name="Poll">
             <fixed-frequency-scheduler frequency="1"
                 timeUnit="MINUTES" />
             <expression-component doc:name="START FTP FLOW"><![CDATA[if(app.registry.processFTPFlow.isStopped()){
                app.registry.processFTPFlow.start();
        }]]></expression-component>
         </poll>
         <logger message="Poll Logging: #[payload]" level="INFO"
             doc:name="Logger" />
     </flow>
     <flow name="processFTPFlow" initialState="stopped">
         <ftp:inbound-endpoint host="localhost" port="21"
             path="/data/ftp" user="Sanjeet" password="sanjeet123" responseTimeout="10000"
             doc:name="FTP" connector-ref="FTP" />
         <logger message="Logging FTP #[payload]" level="INFO" doc:name="Logger" />
         <expression-component doc:name="STOP FTP FLOW"><![CDATA[app.registry.processFTPFlow.stop();]]></expression-component>
     </flow>
    

    【讨论】:

      【解决方案2】:

      请提供SSCCE。 根据您的问题,您根本不需要投票。文件连接器已经有这个功能来定期检查文件。这是每 0.123 秒轮询文件的示例

      <file:inbound-endpoint path="/tmp" responseTimeout="10000" doc:name="File" pollingFrequency="123"/>
      

      【讨论】:

      • 轮询范围比简单的文件轮询有更多的选项,例如 cron 计划。这就是想使用带有投票范围的文件连接器的原因,我的问题有你的答案,谢谢你的回复。
      【解决方案3】:

      我的建议是使用文件连接器旁边的石英连接器,并在石英连接器中设置间隔。或者使用具有轮询频率的文件连接器本身,因此无需将文件包装在轮询范围内。

      【讨论】:

        【解决方案4】:

        您可以在全局元素部分创建一个文件端点,然后使用 mule requester 在轮询范围内调用该端点。

         <file:connector name="File1" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
            <file:endpoint connector-ref="File1" name="File" responseTimeout="10000" doc:name="File" path="/"/>
            <flow name="pocforloggingFlow1">
                <poll doc:name="Poll">
                    <mulerequester:request resource="File" doc:name="Mule Requester"/>
                </poll>
            </flow>

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2018-03-05
          • 1970-01-01
          • 2023-03-15
          • 1970-01-01
          • 1970-01-01
          • 2017-06-27
          • 1970-01-01
          相关资源
          最近更新 更多