1
votes

Bear with me as I'm stuck on what is most likely the simplest of Mule ESB/JMS use-cases. I'm trying to get a Mule app to accept incoming messages from an existing HornetQ Queue. My mule-config.xml is provided below. My problem is this; Whenever the message producer adds a message to the queue, HornetQ is reporting that the message reaches its maximum number of re-delivery attempts for the given message and sends it to the dead-letter queue - apparently never being accepted by the Mule JMS inbound-endpoint. This only happens when the Mule server is running (it is important to note that the app gets deployed in the Mule server without issue), when it is not, of course the provider doesn't attempt any deliveries which is expected. I've used the hornet config in other apps to setup message listeners to the same HornetQ instance without issue. Any assistance would be greatly appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
        http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.4/mule-jms.xsd">

    <beans:bean id="hornetConnectionFactory" class="org.hornetq.jms.client.HornetQXAConnectionFactory">
        <beans:constructor-arg name="ha" value="false" />
        <beans:constructor-arg>
            <beans:bean class="org.hornetq.api.core.TransportConfiguration">
                <beans:constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
                <beans:constructor-arg>
                    <beans:map key-type="java.lang.String" value-type="java.lang.Object">
                        <beans:entry key="host" value="localhost"/>
                        <beans:entry key="port" value="5445"/>
                    </beans:map>
                </beans:constructor-arg>
            </beans:bean>
        </beans:constructor-arg>
    </beans:bean>

    <beans:bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
        <beans:constructor-arg ref="hornetConnectionFactory" />
    </beans:bean>

    <beans:bean id="transactionalConnectionFactory" class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy">
        <beans:property name="targetConnectionFactory" ref="cachingConnectionFactory" />
        <beans:property name="synchedLocalTransactionAllowed" value="true" />
    </beans:bean>

    <jms:connector name="jmsConnector" specification="1.1" connectionFactory-ref="transactionalConnectionFactory"
        validateConnections="true" acknowledgementMode="AUTO_ACKNOWLEDGE" disableTemporaryReplyToDestinations="true" />

    <flow name="MyFlow">
        <jms:inbound-endpoint connector-ref="jmsConnector" queue="MyQueue"
            exchange-pattern="one-way" />
        <logger message="Message #[payload.id] processed successfully" level="DEBUG"/>
    </flow>

</mule>
1

1 Answers

0
votes

I'm wondering if the issue is due to the fact you're using a transactional connection factory: not sure Mule can leverage it, or maybe it can but you'd have to make your JMS inbound endpoint transactional.

Have you tried with using the bare hornetConnectionFactory in the jms:connector?