0

キャメル。ファイル コンポーネント。エラーが発生しなかった場合にのみファイルをコピーするようにルートを構成する必要があります。私が持っているもの:

<route id="importFile" autoStartup="{{fdr.import.enabled}}">
            <from uri="direct:startImportFile"/>
            <from uri="file://{{fdr.folder.working}}?delete=true&amp;readLock=changed"/>
            <transacted ref="fdrTxRequired"/>
            <doTry>
                <to uri="file://{{fdr.folder.done}}"/> <!--1-->
                <bean ref="transactionsProcessor"/>
                <bean ref="transactionsFinalizer"/>
                <!--2-->
                <doCatch>
                    <exception>java.lang.Exception</exception>
                    <to uri="file://{{fdr.folder.failed}}"/>
                    <bean ref="exceptionProcessor"/>
                </doCatch>
                <doFinally>
                    <bean ref="responsePublisher"/>
                </doFinally>
            </doTry>
        </route>

必要なロジック: transactionsProcessor と transactionsFinalizer ですべてが正常に処理された場合は、ファイルを「working」フォルダーから「done」フォルダーに移動しました transactionProcessor または transactionsFinalizer でエラーが発生した場合は、ファイルを「working」から「failed」および「done」に移動します行 1 をプレースホルダー 2 に配置すると、カスタム プロセッサで処理した後、ファイルを InputStream として再配置できません。「作業中」から「完了」に移行できるかもしれません。次に、OK の場合はファイルを処理し、OK の場合はファイルを処理します。エラーが発生した場合は、「完了」から「失敗」に移行します。助けてください。

4

1 に答える 1

0

解決策を見つけました - stopOnExeption を使用したマルチキャスト

<routeContext id="fileImportOnlyRouteContext" xmlns="http://camel.apache.org/schema/spring">
        <route id="importFile" autoStartup="{{fdr.import.enabled}}">
            <from uri="direct:startImportFile"/>
            <from uri="file://{{fdr.folder.working}}?delete=true&amp;readLock=changed"/>
            <transacted ref="fdrTxRequired"/>
            <doTry>
                <multicast stopOnException="true">
                    <to uri="direct:startFileImporter"/>
                    <to uri="file://{{fdr.folder.done}}"/>
                </multicast>
                <doCatch>
                    <exception>java.lang.Exception</exception>
                    <to uri="file://{{fdr.folder.failed}}"/>
                    <bean ref="exceptionProcessor"/>
                </doCatch>
                <doFinally>
                    <bean ref="responsePublisher"/>
                </doFinally>
            </doTry>
        </route>

        <route id="fileImporterRoute">
            <from uri="direct:startFileImporter"/>
            <bean ref="transactionsProcessor"/>
            <bean ref="transactionsFinalizer"/>
        </route>
    </routeContext>
于 2013-02-11T05:29:03.823 に答える