Hi

me again

To configure the redelivey settings in ActiveMQ you should turn to
it's documentation.

A good idea is to use the input search field and type: redelivery.
Then you get google search and can find links:
http://activemq.apache.org/redelivery-policy.html

There might be a better wiki documentation page explaining this for ActiceMQ.
>From the link above you can configure it as URI options for the
ActiveMQ brooker.


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Wed, Nov 19, 2008 at 8:18 AM, Claus Ibsen <[EMAIL PROTECTED]> wrote:
> Hi
>
> a)
> Ah that might not be clearly stated in the documentation.
>
> It's an *all* or *nothing* with transactions. If using transactions
> then it's the backing system (the transaction manger) responsibility
> to handle redelivery - not Camel. Camel in this case only supports
> delaying a fixed delay before the rollback is triggered.
>
> And as you use ActiveMQ as the backing system it is the ActiveMQ
> transaction manger that handles the redelivery. And it uses 5 or is it
> 6 redeliveries by default. So you should configure ActiveMQ how
> redelivery should be done.
>
>
> b)
> That said I turn to the onException
>
> Is TechnicalException and FunctionalException related as such one is
> inherited from the other?
> eg: FunctionalException extends TechnicalException ?
>
> Camel uses (by default) an instanceof test to verify which onException
> should handle the exception.
>
> You might have a use-case using transactions and onException that
> needs to be checked
> - You have onExceptions that also is meent to supoorts catch exception
> this exception and route it differently. And then you can have the
> handled=true to state it's okay, newer mind the exception I have
> handled it and the TX = OK.
> - But it can also be used as a if this exception is thrown then only
> retry 2 times instead of default 5 times etc.
> - etc.
>
> c)
> In any case it should really only call the myOwnErrorHandler only for
> the FunctionalException.
>
> I will check up on your spring XML and add it as a unit test in camel.
>
>
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>
>
>
> On Tue, Nov 18, 2008 at 5:06 PM, Fush <[EMAIL PROTECTED]> wrote:
>>
>> Hi! Below is a snippet of my camel route/xml. As you can see, I'm trying to
>> set up some transaction and error handling there. But I've ran into a couple
>> of strange issues. Are these known? Can anyone here explain them?
>>
>> 1. Even if the exception thrown by myBean is a TechnicalException (ie. not a
>> FunctionalException), the method on the myOwnErrorHandler bean is invoked.
>> How can that happen?
>> 2. Even if maximumRedeliveries is set to 0, for the two onException clauses,
>> as well as in the redeliveryPolicyConfig, the message is redelivered 5 times
>> (as default) when an exception occurs. Why are my settings of 0 not read?
>> 3. Based on the above, can you spot any obvious errors in my configurations?
>> Or should I assume the spring interpretation to be flawed?
>>
>> Here's the important part of my XML:
>>
>> <camelContext id="myRouting"
>>        xmlns="http://activemq.apache.org/camel/schema/spring";>
>>        <route errorHandlerRef="transactionErrorHandler">
>>                <from uri="activemq:queue/myQueue/aQueue" />
>> <!--                    <policy ref="required"/>-->
>>                <choice>
>>                       <when>
>>                                <xpath>//type = 'myType'</xpath>
>>                                <onException>
>>                                        
>> <exception>org.my.exception.TechnicalException
>>                                        </exception>
>>                                        <redeliveryPolicy 
>> maximumRedeliveries="0" />
>>                                        <handled>
>>                                                <constant>true</constant>
>>                                        </handled>
>>                                        <!-- ANY SPECIFIC HANDLING HERE? -->
>>                                </onException>
>>                                <onException>
>>                                        
>> <exception>org.my.exception.FunctionalException
>>                                        </exception>
>>                                        <redeliveryPolicy 
>> maximumRedeliveries="0" />
>>                                        <handled>
>>                                                <constant>true</constant>
>>                                        </handled>
>>                                        <to uri="bean:myOwnErrorHandler" />
>>                                </onException>
>>                                <unmarshal>
>>                                        <jaxb prettyPrint="true" 
>> contextPath="org.my.domain.message" />
>>                                </unmarshal>
>>                                <to uri="bean:myBean" />
>>                        </when>
>>                </choice>
>>        </route>
>> </camelContext>
>>
>> <bean id="jmsTransactionManager"
>> class="org.springframework.jms.connection.JmsTransactionManager">
>>        <property name="connectionFactory" ref="jmsConnectionFactory" />
>> </bean>
>>
>> <bean id="jmsConnectionFactory"
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>        <property name="brokerURL" value="${org.my.activemq.url}"/>
>> </bean>
>>
>> <bean id="jmsConfig"
>> class="org.apache.camel.component.jms.JmsConfiguration">
>>   <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>   <property name="transactionManager" ref="jmsTransactionManager"/>
>>   <property name="transacted" value="true"/>
>>   <property name="concurrentConsumers" value="1"/>
>> </bean>
>>
>> <!-- camel policy we refer to in our route -->
>> <bean id="required"
>> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>>        <property name="template" ref="PROPAGATION_REQUIRED"/>
>> </bean>
>>
>> <!-- the standard spring transaction template for required -->
>> <bean id="PROPAGATION_REQUIRED"
>> class="org.springframework.transaction.support.TransactionTemplate">
>>    <property name="transactionManager" ref="jmsTransactionManager"/>
>> </bean>
>>
>> <!-- the transaction error handler we refer to from the route -->
>> <bean id="transactionErrorHandler"
>> class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
>>    <property name="transactionTemplate" ref="PROPAGATION_REQUIRED"/>
>>    <!-- here we refer to the configurations of the error handler -->
>>    <property name="delayPolicy" ref="redeliveryPolicyConfig"/>
>> </bean>
>>
>> <!-- configuration of the transaction error handler -->
>> <bean id="redeliveryPolicyConfig"
>> class="org.apache.camel.processor.RedeliveryPolicy">
>>    <property name="delay" value="5000"/>
>>    <property name="maximumRedeliveries" value="0"/>
>> </bean>
>>
>> <!-- ActiveMQ instance -->
>> <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
>>    <property name="configuration" ref="jmsConfig"/>
>> </bean>
>>
>> <bean id="myOwnErrorHandler" class="org.my.beans.MyErrorHandler"/>
>>
>> <bean id="myBean" class="org.my.beans.MyBean"/>
>> --
>> View this message in context: 
>> http://www.nabble.com/1.5-error-handling-Spring-config-buggy-not-complete--tp20562554s22882p20562554.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>

Reply via email to