Hi,

I would like to know if onException can be used in combination with
transacted routes

Here is a example

<camelContext/>

                   <!-- Business error that we would like to report to our
client -->
                    <camel:onException>

<camel:exception>com.xpectis.x3s.exception.X3SClientException</camel:exception>
                        <camel:bean ref="serviceHelper"
method="processException" /> // DATA ARE INSERTED IN DB
                        <camel:to ref="queueReportingEndpoint" /> // DATA
ARE SEND ALSO TO A QUEUE FOR REPORTING
                    </camel:onException>

                    <-- Non business errors must be send to the LOG and
rollback should take place -->
                    <camel:onException>
                    <camel:exception>java.lang.Exception</camel:exception>
                        <camel:to
uri="log:com.xpectis.x3s?level=INFO&amp;multiline=true&amp;showException=true&amp;showCaughtException=true&amp;showStackTrace=true"
/>
                        <camel:rollback/>
                    </camel>

        <camel:route errorHandlerRef="txErrorHandlerReqNew">
            <camel:from ref="fileClientEndpoint" />
            <camel:transacted ref="PROPAGATION_REQUIRED_NEW" />

                <camel:setHeader headerName="origin">
                    <camel:constant>file</camel:constant>
                </camel:setHeader>

                <!-- Set Message type header with the name of the parent
folder -->
                <camel:bean ref="serviceHelper" method="getParentFolderName"
/>

                <camel:convertBodyTo type="java.lang.String" />

                <!-- Call the requestService to save the request -->
                <camel:bean ref="serviceHelper" method="createRequest" />

                <!--  <camel:bean ref="serviceHelper"
method="generateX3SClientException" />  -->

                <camel:to ref="queueRequestEndpoint" />

        </camel:route>

</camelContext>

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Reply via email to