4
votes

I have very simple setup of MULE reading from the HornetQ queue and saving Object to database:

setup below:

<jms:connector name="connector.jms" maxRedelivery="1" connectionFactory-ref="hornetQConnectionFactory" doc:name="JMS"
        createMultipleTransactedReceivers="true"
        numberOfConcurrentTransactedReceivers="100"
        acknowledgementMode="AUTO_ACKNOWLEDGE">
    <reconnect count="50" frequency="5000"/>       
</jms:connector>
<flow name="jmsListenerFlow1" doc:name="jmsListenerFlow1">
    <jms:inbound-endpoint queue="adsLogQueue" connector-ref="connector.jms" doc:name="JMS">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:inbound-endpoint>
    <component >
        <spring-object bean="logSaver"/>
    </component>

</flow>

Why do I get a message that message has been redelivered 9 times on endpoint while maxRedelivery setting is 1 ? What does it exactly mean ?

hornetQConnectionFactory:

        <bean name="hornetQTransportConfiguration" class="org.hornetq.api.core.TransportConfiguration">
        <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"/>
        <constructor-arg>
            <map>
                <entry key="host" value="${jms.host}" /> 
                <entry key="port" value="${jms.port}" /> 
            </map>
        </constructor-arg>

    </bean>
    <bean name="hornetQConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
        <constructor-arg index="0" value="false"/>
        <constructor-arg index="1" ref="hornetQTransportConfiguration"/>
        <property name="minLargeMessageSize" value="250000"/>
        <property name="cacheLargeMessagesClient" value="false"/>
    </bean>

Any help will be appreciated!

Stack trace below.

ERROR 2012-10-19 01:04:07,283 [Thread-3013 (HornetQ-client-global-threads-1442093417)]: 

Message               : "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage
Code                  : MULE_ERROR--2

Exception stack is:
1. "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException)
  org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:91 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html)

Root Exception stack trace:
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage
    at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:91)
    at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:418)
    at org.mule.transport.AbstractReceiverWorker$1$1.process(AbstractReceiverWorker.java:120)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
1
Could you share the hornetQConnectionFactory configuration as well?genjosanzo
@genjosanzo Added Thanks for looking into thisBill Boost
Do you have several Mule instances connected to the same queue?David Dossot
@DavidDossot Hi yes i have two mule instances connected to the same queue on Production, although It happened also on my local environment where there is only one mule connected to the queueBill Boost

1 Answers

6
votes

The first thing to note is that Mule is using JmsXRedeliveryHandler, which means it has detected that HornetQ supports the JMS_X_DELIVERY_COUNT header and will take care of counting the re-deliveries. In that situation, Mule fully relies on HornetQ for providing an accurate count of re-deliveries.

The fact this exception is thrown means that a JMS message has been presented to Mule with a redelivery count that exceeds the count configured on the JMS connector (1 in your case).

Since you consume in a transaction, what's likely to happen is that HornetQ will rollback and represent this message to Mule, on each restart, again and again unless you've configured a maximum redelivery count on HornetQ itself.

My advice is: set the same redelivery count on Mule and HornetQ or use -1 on Mule (no limit) and fully rely on HornetQ's redelivery limit.