具有CLIENT_ACKNOWLEDGE模式的Mule JMS?即使我没有确认邮件,邮件也会自动消耗 [英] Mule jms with CLIENT_ACKNOWLEDGE mode? Message automatically consumed even though I didn't acknoeledge it
问题描述
我已经使用CLIENT_ACKNOWLEDGE模式创建了一个简单的Mule JMS流.我对"CLIENT_ACKNOWLEDGE"的理解是,我们必须在接收方或客户端明确确认消息,直到确认之前,消息不会从队列中消耗.
I've created a simple mule JMS flow with CLIENT_ACKNOWLEDGE mode. My understanding with 'CLIENT_ACKNOWLEDGE' is that we have to explicitly acknowledge the message on receiver or client side, it will not consume from the queue until it would not acknowledge.
<spring:beans>
<spring:bean name="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://localhost:61616" />
<spring:property name="redeliveryPolicy">
<spring:bean class="org.apache.activemq.RedeliveryPolicy">
<spring:property name="maximumRedeliveries" value="10" />
<spring:property name="initialRedeliveryDelay"
value="1000" />
</spring:bean>
</spring:property>
</spring:bean>
</spring:beans>
<jms:connector name="Active_MQ3" connectionFactory-ref="connectionFactory" acknowledgementMode="CLIENT_ACKNOWLEDGE" maxRedelivery="10" persistentDelivery="true" specification="1.1" />
<flow name="main1" doc:name="main1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" path="test" port="8099" doc:name="HTTP"/>
<logger message="starting main flow" level="INFO" doc:name="Logger"/>
<jms:outbound-endpoint queue="StudioIN" connector-ref="Active_MQ3" doc:name="JMS">
<jms:transaction action="NONE"/>
</jms:outbound-endpoint>
</flow>
//reading msg from queue, not acknowledging
<flow name="worker1" doc:name="worker1">
<jms:inbound-endpoint queue="StudioIN" connector-ref="Active_MQ1" doc:name="JMS"/>
<logger message="Consuming payload: #[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
在我的测试流程中,我没有确认该消息,但仍然被占用.我们如何将消息保持在队列中,直到得到客户端或接收方的确认?
In my test flow I haven't acknowledge the message, but it still got consumed. How we can keep message in queue until it get acknowledge from client or receiver side?
<!-------------- Updated flow ------------------------>
<flow name="worker1" doc:name="worker1">
<jms:inbound-endpoint queue="StudioIN" connector-ref="Active_MQ1" doc:name="JMS">
<jms:client-ack-transaction action="ALWAYS_BEGIN"/>
</jms:inbound-endpoint>
<logger message="Consuming payload: #[payload]" level="INFO" doc:name="Logger"/>
</flow>
推荐答案
您在JMS入站端点中缺少client-ack-transaction
元素.
You're missing a client-ack-transaction
element in your JMS inbound endpoint.
有关该主题的文档非常简短: http ://www.mulesoft.org/documentation/display/current/JMS+Transport+Reference#JMSTransportReference-Clientacktransaction
The doc is very thin on the subject: http://www.mulesoft.org/documentation/display/current/JMS+Transport+Reference#JMSTransportReference-Clientacktransaction
我打算为您提供使用此标记的集成测试链接,但找不到任何:(参见:
I was planning to provide you with links to integration tests using this tag but can't find any :( See: https://github.com/mulesoft/mule/search?utf8=%E2%9C%93&q=client-ack-transaction&type=Code
这篇关于具有CLIENT_ACKNOWLEDGE模式的Mule JMS?即使我没有确认邮件,邮件也会自动消耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!