我们正在尝试使用Mule ESB和JBoss消息来构建简单的事务jms到jms路由器。当我们使用配置如下的应用程序运行Mule ESB时,我们会观察到奇怪的行为。
当我们开始测试时,队列test1被大约500条消息填充。我们使用Mule 3.2和JBoss 5.1。
如果从下面的代码中删除事务运行良好,那么所有消息都会立即发送到test2队列中。而且,如果我将事务从xa更改为jms --将xa事务标记替换为jms:transaction,则一切都很好。
我不知道是什么导致了ESB上消息处理的暂停,可能是事务提交延迟了。
我的问题是:要让xa事务正常工作,我应该做些什么?
如果需要的话我会提供更多的细节。我以前在Mule ESB论坛上问过这个问题,但没有回答另一个。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jbossts:transaction-manager> </jbossts:transaction-manager>
<configuration>
<default-threading-profile maxThreadsActive="30" maxThreadsIdle="5"/>
<default-receiver-threading-profile maxThreadsActive="10" maxThreadsIdle="5"/>
</configuration>
<spring:beans>
<spring:bean id="jmsJndiTemplate" class="org.springframework.jndi.JndiTemplate" doc:name="Bean">
<spring:property name="environment">
<spring:props>
<spring:prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</spring:prop>
<spring:prop key="jnp.disableDiscovery">true</spring:prop>
<spring:prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</spring:prop>
<spring:prop key="java.naming.provider.url">localhost:1099</spring:prop>
</spring:props>
</spring:property>
</spring:bean>
<spring:bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" doc:name="Bean">
<spring:property name="jndiTemplate">
<spring:ref bean="jmsJndiTemplate"/>
</spring:property>
<spring:property name="jndiName">
<spring:value>XAConnectionFactory</spring:value>
</spring:property>
</spring:bean>
</spring:beans>
<jms:connector name="JMS" specification="1.1" numberOfConsumers="10" connectionFactory-ref="jmsConnectionFactory" doc:name="JMS"/>
<flow name="flow" doc:name="flow">
<jms:inbound-endpoint queue="test1" connector-ref="JMS" doc:name="qt1">
<xa-transaction action="ALWAYS_BEGIN"/>
</jms:inbound-endpoint>
<echo-component doc:name="Echo"/>
<jms:outbound-endpoint queue="test2" connector-ref="JMS" doc:name="qt2">
<xa-transaction action="ALWAYS_JOIN"/>
</jms:outbound-endpoint>
<echo-component doc:name="Echo"/>
</flow>
</mule>这里您可以为1条消息交互找到日志片段。请注意,在这种情况下,没有任何延误。这里是11条消息的日志片段。当应用程序启动时,它们都在队列test1中,因为您可以看到10条消息被立即路由,一条消息被延迟1分钟。
发布于 2012-05-08 13:54:43
我找到了问题的根源:我的队列是用以下属性定义的:
<attribute name="RedeliveryDelay">60000</attribute>删除它或设置低值解决了我的延迟问题。问题是,我不知道为什么:)
我一直认为当交付失败时会使用重发延迟,这在我的应用程序中不是这样的。
https://stackoverflow.com/questions/10481209
复制相似问题