3

これは私の以前の質問の拡張です。How to upload multiple files via REST over HTTP using Mule? . 要件は、毎週水曜日の午前 10 時にファイルをアップロードする必要があることです。今後、これを達成するためのスケジューラが必要です。そして、Cron Expression を使用した「Quartz」インバウンド コンポーネントが解決策であることがわかりました。

しかし、どうすればそうできますか?2つの「インバウンドエンドポイント」(クォーツとファイル)を持つことができないため、例

<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>

実行するとエラーが発生します

スレッド「メイン」での例外 org.mule.module.launcher.DeploymentInitException: SAXParseException: cvc-complex-type.2.4.a: 要素「file:inbound-endpoint」で始まる無効なコンテンツが見つかりました。

それで、私がする必要がある変更は何ですか?

助けてください

4

4 に答える 4

4

これを試して

<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>
于 2013-01-28T04:05:04.740 に答える
2

次の 2 つのオプションがあります。

を。ファイル インバウンド エンドポイントを、ファイル処理を処理するコンポーネントに置き換えます。これは Quartz によってトリガーされ、フォルダーからファイルを取得して、アウトバウンド エンドポイントに渡します。

b. Quartz エンドポイントを使用せず、org.mule.transport.file.FileMessageReceiver をオーバーライドして、ポーリング ファイルのカスタム スケジューリングを実装します。

最初の選択肢はより簡単です。

于 2013-01-23T11:42:35.890 に答える
0

以下は、必要なものが正確に見つからない場合の回避策です。

1- 1 つではなく 2 つのフローを持つことができます。

2-スケジューラにメッセージをキューに入れさせ、別のフローでそのキューからメッセージを取得して処理することができます。

3-ここで提案されているように、quartz:inbound-endpoint を含むコンポーネントを持つことができますhttp://blogs.mulesoft.org/using-quartz-to-trigger-a-service/

上記のいずれかが役立つことを願っています。

于 2013-01-23T11:47:35.683 に答える
0

申し訳ありませんが、これは長すぎるためコメントとして入れることができませんでした。ここでは、<quartz:endpoint-polling-job> Mule Web サイトの例を示します。

<service name="testService5">
  <description>
  The endpoint polling Job will try and perform a 'request' on any Mule endpoint. If a result is received it will be handed off to this 'testService5' service for processing. The trigger will fire every 5 minutes starting at 2pm and ending at 2:55pm, every day. during this period the job will check the file directory /N/drop-data/in every 5 minutes to see if any event data is available. The request will timeout after 4 seconds if there are no files in the directory. 
  </description>

  <inbound>
    <quartz:inbound-endpoint name="qEP5" cronExpression="0 0/5 14 * * ?" jobName="job5"
           connector-ref="quartzConnector1">
      <quartz:endpoint-polling-job>
        <quartz:job-endpoint address="file:///N/drop-data/in" timeout="4000"/>
      </quartz:endpoint-polling-job>
    </quartz:inbound-endpoint>
  </inbound>
</service>

上記が役立つことを願っています

于 2013-01-24T11:19:26.020 に答える