[
https://issues.apache.org/activemq/browse/CAMEL-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54021#action_54021
]
Charles Moulliard commented on CAMEL-1965:
------------------------------------------
Thx for the patch Claus ;-)
The issue is no more there and the file has been moved correctly. And now the
ExchangeException has been well received by the bean in this route section :
{code}
<camel:onException>
<camel:exception>com.xpectis.x3s.exception.X3SClientException</camel:exception>
<camel:bean ref="serviceHelper" method="processException" />
<camel:to ref="queueReportingEndpoint" />
</camel:onException>
{code}
> onException does not work correctly when used in a transacted route and
> exception is not send to the bean component called
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-1965
> URL: https://issues.apache.org/activemq/browse/CAMEL-1965
> Project: Apache Camel
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Charles Moulliard
> Attachments: BookService.java, file_patch.patch,
> springTransactionalClientDataSourceUsingTransactedOnException.xml,
> SpringTransactionalClientDataSourceUsingTransactedOnExceptionTest.java,
> transactionalClientDataSource.xml
>
>
> Hi,
> When onException is used within a transacted route, it does not work. With
> the following route, the onException process does not propagate information
> to the from endpoint (in my case : file component). So, when X3Sexception
> occurs, the bean component is called where record is created in an Audit
> table, error message is put in a reporting queue BUT the file could not be
> renamed and move to temp directory. In consequence, the file is reprocessed
> continuously !!!!!
> {code}
> Route
> <camel:route errorHandlerRef="txErrorHandlerReqNew">
> <camel:from ref="fileClientEndpoint" />
> <camel:transacted ref="PROPAGATION_REQUIRED_NEW" />
>
> <camel:onException>
>
> <camel:exception>com.xpectis.x3s.exception.X3SClientException</camel:exception>
> <camel:bean ref="serviceHelper" method="processException" />
> <camel:to ref="queueReportingEndpoint" />
> </camel:onException>
>
> <camel:onException>
> <camel:exception>java.lang.Exception</camel:exception>
> <camel:to
> uri="log:com.xpectis.x3s?level=INFO&multiline=true&showException=true&showCaughtException=true&showStackTrace=true"
> />
> <camel:rollback/>
> </camel:onException>
> {code}
> {code}
> Log
> 16:51:12,896 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>>
> from(file://d:/temp/data/oinp/?delay=15000&move=d%3A%2Ftemp%2Fdata%2Foinp%2Fbackup%2F%24%7Bdate%3Anow%3AyyyyMMdd%7D%2F%24%7Bfile%3Aname.noext%7D.bak&moveFailed=d%3A%2Ftemp%2Fdata%2Foinp%2Ferror%2F%2F%24%7Bdate%3Anow%3AyyyyMMdd%7D%2F%24%7Bfile%3Aname.noext%7D.error)
> --> ref:PROPAGATION_REQUIRED_NEW, Pattern:InOnly,
> Headers:{CamelFileNameOnly=OINP_Example.csv, CamelFileLastModified=Mon Jul 27
> 16:33:12 CEST 2009, CamelFileAbsolute=true, CamelFileLength=892,
> CamelFileName=OINP_Example.csv, CamelFileParent=d:\temp\data\oinp,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID, ...
> 16:51:12,912 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> ref:PROPAGATION_REQUIRED_NEW -->
> ref:PROPAGATION_REQUIRED_NEW, Pattern:InOnly,
> Headers:{CamelFileNameOnly=OINP_Example.csv, CamelFileLastModified=Mon Jul 27
> 16:33:12 CEST 2009, CamelFileAbsolute=true, CamelFileLength=892,
> CamelFileName=OINP_Example.csv, CamelFileParent=d:\temp\data\oinp,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:12,912 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> ref:PROPAGATION_REQUIRED_NEW -->
> OnException, Pattern:InOnly, Headers:{CamelFileNameOnly=OINP_Example.csv,
> CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009, CamelFileAbsolute=true,
> CamelFileLength=892, CamelFileName=OINP_Example.csv,
> CamelFileParent=d:\temp\data\oinp,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:12,928 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> OnException -->, Pattern:InOnly,
> Headers:{CamelFileNameOnly=OINP_Example.csv, CamelFileLastModified=Mon Jul 27
> 16:33:12 CEST 2009, CamelFileAbsolute=true, CamelFileLength=892,
> CamelFileName=OINP_Example.csv, CamelFileParent=d:\temp\data\oinp,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:12,928 | INFO | 9: FileComponent | ServiceHelper |
> ctis.x3s.core.util.ServiceHelper 1033 | ###### processException ######
> 16:51:12,928 | INFO | 9: FileComponent | ServiceHelper |
> ctis.x3s.core.util.ServiceHelper 1046 | #### Exception received was null so
> create a dummy exception !
> 16:51:12,928 | INFO | 9: FileComponent | ServiceHelper |
> ctis.x3s.core.util.ServiceHelper 1054 | >>>processException
> AUDIT:E9998:Error:ERR
> 16:51:12,975 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> -->
> queuingservice://x3s:reporting, Pattern:InOnly,
> Headers:{CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv, CamelFileLength=892,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelBeanMethodName=null, CamelFileNameOnly=OINP_Example.csv,
> CamelFileAbsolute=true, CamelBeanMultiParameterArray=false,
> CamelFileName=OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileParent=d:\temp\data\oinp},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,
> 16:51:13,068 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> queuingservice://x3s:reporting
> --> ref:PROPAGATION_REQUIRED_NEW, Pattern:InOnly,
> Headers:{CamelFileAbsolute=true, CamelFileLength=892,
> CamelBeanMethodName=null, CamelFileName=OINP_Example.csv,
> CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileNameOnly=OINP_Example.csv, CamelBeanMultiParameterArray=false,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileParent=d:\temp\data\oinp},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:13,068 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> ref:PROPAGATION_REQUIRED_NEW -->
> OnException, Pattern:InOnly, Headers:{CamelFileAbsolute=true,
> CamelFileLength=892, CamelBeanMethodName=null,
> CamelFileName=OINP_Example.csv, CamelFileLastModified=Mon Jul 27 16:33:12
> CEST 2009, CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileNameOnly=OINP_Example.csv, CamelBeanMultiParameterArray=false,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileParent=d:\temp\data\oinp},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:13,084 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>> OnException -->
> log://com.xpectis.x3s?level=INFO&multiline=true&showCaughtException=true&showException=true&showStackTrace=true,
> Pattern:InOnly, Headers:{CamelFileAbsolute=true, CamelFileLength=892,
> CamelBeanMethodName=null, CamelFileName=OINP_Example.csv,
> CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileNameOnly=OINP_Example.csv, CamelBeanMultiParameterArray=false,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileParent=d:\temp\data\oinp},
> BodyType:org.apache.camel.component.file.GenericFile, Body:ORD_REF_ID,...
> 16:51:13,084 | INFO | 9: FileComponent | x3s |
> rg.apache.camel.processor.Logger 88 | Exchange[
> , BodyType:org.apache.camel.component.file.GenericFile
> , Body:ORD_REF_ID,...
> 16:51:13,084 | INFO | 9: FileComponent | TraceInterceptor |
> rg.apache.camel.processor.Logger 88 |
> ID-dell-charles-2415-1251709696459-0-85 >>>
> log://com.xpectis.x3s?level=INFO&multiline=true&showCaughtException=true&showException=true&showStackTrace=true
> --> Rollback, Pattern:InOnly, Headers:{CamelFileName=OINP_Example.csv,
> CamelBeanMethodName=null, CamelBeanMultiParameterArray=false,
> CamelFileParent=d:\temp\data\oinp, CamelFileNameOnly=OINP_Example.csv,
> CamelFileAbsolutePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFilePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileRelativePath=d:\temp\data\oinp\OINP_Example.csv,
> CamelFileLastModified=Mon Jul 27 16:33:12 CEST 2009, CamelFileAbsolute=true,
> CamelFileLength=892}, BodyType:org.apache.camel.component.file.GenericFile,
> Body:ORD_REF_ID,...
> 16:51:13,100 | ERROR | 9: FileComponent | GenericFileOnCompletion |
> rg.apache.camel.processor.Logger 202 |
> org.apache.camel.RollbackExchangeException: Intended rollback on the
> exchange: Exchange[GenericFileMessage with file:
> GenericFile[d:\temp\data\oinp\OINP_Example.csv]]
> 16:51:13,100 | WARN | 9: FileComponent | GenericFileOnCompletion |
> ent.file.GenericFileOnCompletion 142 | Rollback file strategy:
> org.apache.camel.component.file.strategy.genericfilerenameprocessstrat...@29e26
> for file: GenericFile[d:\temp\data\oinp\OINP_Example.csv]
> 16:51:13,100 | ERROR | 9: FileComponent | GenericFileOnCompletion |
> rg.apache.camel.processor.Logger 248 | Cannot rename file:
> GenericFile[d:\temp\data\oinp\OINP_Example.csv] to:
> GenericFile[d:\temp\data\oinp\error\\20090831\OINP_Example.error]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> rename file: GenericFile[d:\temp\data\oinp\OINP_Example.csv] to:
> GenericFile[d:\temp\data\oinp\error\\20090831\OINP_Example.error]
> at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.renameFile(GenericFileRenameProcessStrategy.java:96)
> at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.rollback(GenericFileRenameProcessStrategy.java:61)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyRollback(GenericFileOnCompletion.java:145)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:95)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onFailure(GenericFileOnCompletion.java:58)
> at
> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:126)
> {code}
> REMARK :
> - Exception object is not received by the bean component
> but everything works fine if the route is defined like this
> {code}
> <camel:route>
> <camel:from ref="fileClientEndpoint" />
> <camel:onException>
>
> <camel:exception>com.xpectis.x3s.exception.X3SClientException</camel:exception>
> <camel:bean ref="serviceHelper"
> method="processException" />
> <camel:to ref="queueReportingEndpoint" />
> </camel:onException>
>
> <camel:onException>
>
> <camel:exception>java.lang.Exception</camel:exception>
> <camel:to
> uri="log:com.xpectis.x3s?level=INFO&multiline=true&showException=true&showCaughtException=true&showStackTrace=true"
> />
> </camel:onException>
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.