2
我一直在嘗試在駝峯上下文(駝峯2.8)中配置jms終結點(activemq 5.7),所以它應該使用回滾消息的重新遞送。不幸的是,它並沒有像我期望的那樣工作:它將一條消息返回給一個隊列,但是消費者在這之後即使指定了延遲參數也會接收到該消息。重新遞送延遲設置在ActiveMQXAConnectionFactory上不起作用
我的配置如下:
...
<bean id="jmstx" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsTxConfig" />
</bean>
<bean id="jmsTxConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsXaPoolConnectionFactory"/>
<property name="transactionManager" ref="osgiPlatformTransactionManager"/>
<property name="transacted" value="false"/>
<property name="cacheLevelName" value="CACHE_NONE"/>
<property name="concurrentConsumers" value="${jms.concurrentConsumers}" />
</bean>
<bean id="jmsXaPoolConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory">
<property name="maxConnections" value="${jms.maxConnections}" />
<property name="connectionFactory" ref="jmsXaConnectionFactory" />
<property name="transactionManager" ref="osgiJtaTransactionManager" />
</bean>
<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="${jms.broker.url}"/>
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="-1"/>
<property name="initialRedeliveryDelay" value="2000" />
<property name="redeliveryDelay" value="5000" />
</bean>
</property>
</bean>
,演示了我如何使用端點A小樣本:
<route id="main-route">
<from uri="jmstx:queue:my-queue" />
<to uri="direct:subroute" />
...
<!-- some logic -->
</route>
<route id="subroute">
<from uri="direct:subroute" />
<transacted ref="PROPAGATION_MANDATORY"/>
...
<!-- Rollback on some condition -->
<rollback/>
...
</route>
有誰知道爲什麼會發生? 謝謝。