Thanks Claus for the reply.
Do you have any example how to set DLQ for smx4.2. I tried setting DLQ in
activemq-broker.xml as below, but has no effect.
Do I need to set my error handler to DeadletterChannel somehow instead of
transactionErrorHandler?

activemw-broker destinationPolicy setting:

 <destinationPolicy>
            <policyMap>
                <policyEntries>
                    <policyEntry topic=">" producerFlowControl="true"
memoryLimit="1mb">
                        <pendingSubscriberPolicy>
                            <vmCursor />
                        </pendingSubscriberPolicy>
                    </policyEntry>
                    <policyEntry queue=">" producerFlowControl="true"
memoryLimit="1mb">
                    <deadLetterStrategy>
                                <individualDeadLetterStrategy queuePrefix="DLQ."
useQueueForQueueMessages="true" />
                        </deadLetterStrategy>                        <!--
Use VM cursor for better latency
                             For more information, see:

                             http://activemq.apache.org/message-cursors.html
      
                        <pendingQueuePolicy>
                          <vmQueueCursor/>
                        </pendingQueuePolicy>
                        -->
                    </policyEntry>
                </policyEntries>
            </policyMap>
        </destinationPolicy>

Here is my camel_context.xml

        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
                <property name="configuration" ref="jmsConfig" />

        </bean>
        <bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="tcp://LPF004689:61616" />
                <property name="redeliveryPolicy" ref="redeliveryPolicy" />     
        <!--
                        <property name="transactionManager" 
ref="jmsTransactionManager" />
                        <property name="transacted" value="true" />
                -->
        </bean>
        <bean id="redeliveryPolicy" 
class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="1" />
        </bean>
        <bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
                <property name="connectionFactory" ref="jmsConnectionFactory" />
                <property name="concurrentConsumers" value="5" />
                <property name="transactionManager" ref="jmsTransactionManager" 
/>
                <property name="transacted" value="true" />
                <property name="deliveryPersistent" value="true"/>
<property name="explicitQosEnabled" value="true"/>
        </bean>

        <bean id="jmsTransactionManager"
                
class="org.springframework.jms.connection.JmsTransactionManager">
                <property name="connectionFactory" ref="jmsConnectionFactory" />
        </bean>
        <bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
                <property name="transactionManager" ref="jmsTransactionManager" 
/>
                <property name="propagationBehaviorName" 
value="PROPAGATION_REQUIRED" />
        </bean>
        <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";
                trace="true">
                <package>com.pf.simplecamelconsumer</package>


        </camelContext>
</beans>
        
MyRouterBuilder configure method:
public void configure() {

         MyProcessorBean myBean = new
com.pf.simplecamelconsumer.MyProcessorBean();
         //do not need to create one, automatically discover it
        //SpringTransactionPolicy transactionPolicy =
bean(SpringTransactionPolicy.class, "PROPAGATION_REQUIRED");
        
          
    
onException(Throwable.class).maximumRedeliveries(1).handled(false).process(new
MyErrorHandler());       
        from("jms:queue:queue1").transacted("PROPAGATION_REQUIRED")     
.bean(myBean,"setLocationUrI")
        
.recipientList(header(Constants.DYNAMIC_HTTP_URI)).bean(myBean,"printResponse");
                        
                
                        
   
                 
            }


Claus Ibsen-2 wrote:
> 
> On Tue, May 4, 2010 at 7:53 PM, gnanda <[email protected]>
> wrote:
>>
>> Hi All,
>>  I upgraded my code from smx4.0 to smx4.2 to get better error handling
>> feature with transaction support.
>>
>> But looks like it is not doing as I was expecting. I could get
>> onException
>> block works with transactional route. But if  the transaction fail at the
>> end, it does not go to DeadLetterQueue which I configured in
>> activemq-broker.xml file. After reading the documents I got to know that
>> transactionalErrorHandler ignores DLQ setting.
>>
> 
> Yes it does. If the message was set to rollback or an exception was
> not handled, then the JMS will receive this error.
> And if you have JMS Broker configured to move to DLQ after X attempts
> it will do so.
> 
> I assume you may have configured JMS Broker to move to DLQ after 6
> attempts, and then you have Camel configured to retry X times as well.
> That gives you total 6 * X times.
> 
> 
> 
> 
>> We cannot afford loosing any message in our scenario.
>>
> 
> Let the JMS Broker handle the redelivery and move to DLQ after X attempts.
> It has various options to configure this.
> 
> 
>> Is there any way I could configure the transactionErrorHandler to reroute
>> the message to any other queue (example "errorQ") in case of failure?
>>
>> Please help.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/smx4%3Acamel2.2-transactional-error-handling-tp28450957p28450957.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/smx4%3Acamel2.2-transactional-error-handling-tp28450957p28461083.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to