Hello, 

We are using a Camel/ActiveMQ/Spring configuration. We have setup a
persistent queue backed by Kaha, and transactional configuration using
org.springframwork.jms.connection.JmsTransactionManager.

We are trying to get the exception/re-delivery working correctly, and find
that while the maximumRedeliveries configuration is honored, the
redeliveryDelay is not. Rather, redelivery is executed immediately when the
exceptioning consumer is finished executing it's
rollback/close/synchronization logic.

Any input/experience would help...

The most confusing thing here, is that there redelivery count is honored,
and running the code in the debugger we see the redeliveryDelay is set, and
calculated correctly. There is even a scheduled task set to redeliver the
message. However, as the infrastructure (ActiveMQMessageConsumer) is
iterating through it's synchronizations during the rollback processing, a
call to ActiveMQMessageConsumer.synchronization.afterRollback() results in
an immediate redelivery of the message.


/Below is our actual configuration./


Our JMS configuration:

   
    <bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration">
            <bean class="org.apache.camel.component.jms.JmsConfiguration">
                <property name="transacted" value="true"/>
                <property name="transactionManager"
ref="jmsTransactionManager"/>
                <property name="errorHandlerLogStackTrace" value="false"/>

                
                <property name="concurrentConsumers"
value="${jms.concurrentConsumers:10}" />
                <property name="connectionFactory"
ref="jmsConnectionFactory"/>
            </bean>
        </property>
    </bean>
    <bean id="jmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start"
destroy-method="stop">
        <property name="maxConnections" value="${jms.maxConnections:8}" />
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL"
value="tcp://${jms.host:localhost}:${jms.port:8791}" />
                <property name="redeliveryPolicyMap"
ref="jmsRedeliveryPolicyMap" />
            </bean>
        </property>
        <property name="idleTimeout" value="0" />
    </bean>
    <amq:redeliveryPolicyMap id="jmsRedeliveryPolicyMap">
        <amq:redeliveryPolicyEntries>
            <bean class="org.apache.activemq.RedeliveryPolicy">
                <property name="queue" value="mailSender" />
                <property name="redeliveryDelay" value="#{ 1000 *
${mta.redeliveryDelay:300}}" />
                <property name="initialRedeliveryDelay" value="#{1000 *
${mta.redeliveryDelay:300}}" />
                <property name="maximumRedeliveryDelay" value="#{1000 *
${mta.redeliveryDelay:300}}" />
                <property name="maximumRedeliveries"
value="${mta.maximumRedeliveries:3}" />
            </bean>
        </amq:redeliveryPolicyEntries>
        <amq:defaultEntry>
            <amq:redeliveryPolicy maximumRedeliveries="0" />
        </amq:defaultEntry>
    </amq:redeliveryPolicyMap>

our camel/consumer configuration:
       <camel:route id="mailSenderJMSConsumer">
            <camel:from uri="jms:queue:mailSender" />
            <camel:transacted/>

            
            <camel:onException redeliveryPolicyRef="emailSendFailurePolicy">
               
<camel:exception>com.sendmail.reac.email.RetryableEmailException</camel:exception>
                
                <camel:handled>
                    <camel:constant>false</camel:constant>
                </camel:handled>
                <camel:log loggingLevel="WARN" message="${exception}"
logName="com.sendmail.reac.camel"/>
            </camel:onException>

            
            <camel:onException redeliveryPolicyRef="emailSendFailurePolicy">
                <camel:exception>java.lang.Throwable</camel:exception>
                
                <camel:handled>
                    <camel:constant>true</camel:constant>
                </camel:handled>
                <camel:log loggingLevel="ERROR" message="${exception}"
logName="com.sendmail.reac.camel"/>
            </camel:onException>

           
           <camel:to
uri="bean:mailSender?method=createMimeMessageFromEmlString(${out.body})" />
           <camel:to uri="ref:emailEndpoint" />
       </camel:route>



thanks for any insight!




--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMQ-Camel-RedeliveryDelay-configuration-is-not-used-immediate-redlivery-instead-tp4671869.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to