How could I use TransactionErrorHandler with a customized FailureProcessor?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How could I use TransactionErrorHandler with a customized FailureProcessor?

yeknod
hi,

I want to setup a global TransactionErrorHandler to handle all the exception in my routes, and it's also need to link with a customized processor, in which I could do anything with the exception, for example, log the exception into database.

the following is what I suppose to achieve:

        <bean id="exceptionHandler" class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder" >
                <property name="failureProcessor" ref="customizedEexceptionProcessor"></property>
        </bean>
        <bean id="customizedEexceptionProcessor"
                class="log.exception.to.database">
        </bean>
        <camel:camelContext xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="customizedExceptionHandler">
                <camel:route>
                        <camel:from uri="direct:start"/>
                        <camel:transacted/>
                        <to uri="jms:requests?disableReplyTo=true"/>
                        <camel:bean ref="throwExceptionForcelyProcessor"></camel:bean>
                </camel:route>
        </camel:camelContext>
Reply | Threaded
Open this post in threaded view
|

Re: How could I use TransactionErrorHandler with a customized FailureProcessor?

Christian Mueller
Administrator
You can use the "errorHandler" definition in the Spring XML DSL as
explained in [1].

[1] http://camel.apache.org/error-handler.html

Best,
Christian

On Tue, May 15, 2012 at 8:45 AM, yeknod <[hidden email]> wrote:

> hi,
>
> I want to setup a global TransactionErrorHandler to handle all the
> exception
> in my routes, and it's also need to link with a customized processor, in
> which I could do anything with the exception, for example, log the
> exception
> into database.
>
> the following is what I suppose to achieve:
>
>        <bean id="exceptionHandler"
> class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder" >
>                <property name="failureProcessor"
> ref="customizedEexceptionProcessor"></property>
>        </bean>
>        <bean id="customizedEexceptionProcessor"
>                class="log.exception.to.database">
>        </bean>
>        <camel:camelContext xmlns="http://camel.apache.org/schema/spring"
> errorHandlerRef="customizedExceptionHandler">
>                <camel:route>
>                        <camel:from uri="direct:start"/>
>                        <camel:transacted/>
>                        <to uri="jms:requests?disableReplyTo=true"/>
>                        <camel:bean
> ref="throwExceptionForcelyProcessor"></camel:bean>
>                </camel:route>
>        </camel:camelContext>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-could-I-use-TransactionErrorHandler-with-a-customized-FailureProcessor-tp5709813.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>