2

以下のような流れで:

<flow name="fileFlow">
    <file:inbound-endpoint path="/inbound/ftp/sbc" pollingFrequency="30000" fileAge="30000" moveToDirectory="/inbound/ftp/sbc/archive">
        <file:filename-wildcard-filter pattern="*.xml" caseSensitive="false"/>
    </file:inbound-endpoint>
    <logger message="Entering #[flow.name] flow" level="INFO"/>
    <component class="com.abc.RequestFile"/>
    <logger message="Payload after transformation is: #[payload] flow" level="INFO"/>
     <vm:outbound-endpoint path="merge" />  
    <logger message="Exiting #[flow.name] flow" level="INFO"/>
</flow>

コンポーネントに渡されるものを取得InputStreamします。このコンポーネントは、ファイルのリストを返すために必要です。そのうちの 1 つが、読み取られて渡された元のファイルです。Java コンポーネントで InputStream を File に手動でコピーする以外の解決策を探しています。file:inbound-endpointRequestFile

4

1 に答える 1

6

この回答https://stackoverflow.com/a/12397775/387927java.io.Fileで説明されているように、この設定でコンテンツの代わりにオブジェクトを取得できます。

<file:connector name="fileConnector" streaming="false" autoDelete="false">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>

ファイルの移動/削除は、開始前または処理の完了後に行う必要があることに注意してください。そうしないと、Mule はファイルを何度もポーリングします。

于 2013-09-13T17:03:15.863 に答える