简体   繁体   English

ActiveMQ Spring CLIENT_ACKNOWLEDGE无法正常工作

[英]ActiveMQ Spring CLIENT_ACKNOWLEDGE not working

I can't seem to figure this out... This works perfectly in JAVA: 我似乎无法弄清楚...这在JAVA中非常有效:

// Create a Session
Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); // << means we have to acknowledge that we processed it!

But when I create a Spring Bean, I cannot get the CLIENT_ACKNOWLEDGE to work. 但是,当我创建一个Spring Bean时,我无法使CLIENT_ACKNOWLEDGE工作。 It seems that it's auto-acknowledging all messages. 似乎是自动确认所有消息。

<bean id="testListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" lazy-init="true">
<property name="connectionFactory" ref="amqConnectionFactory" />
    <property name="destinationName" value="MyQueue" />
    <property name="messageListener" ref="testListener" />
    <property name="autoStartup" value="false"/>
    <property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
    <property name="sessionTransacted" value="true"/>
    <property name="concurrency" value="2"/>
</bean>

Anything I'm missing? 我有什么想念的吗?

The DMLC in spring has transactions enabled in your config, while in your Java example, you have transactions disabled. 在春季,DMLC在配置中启用了事务,而在Java示例中,您已禁用了事务。 Transactions overrides any acknowledge modes. 事务将覆盖所有确认模式。 So, choose if you should go with transactions or client ack since you cannot pick both. 因此,请选择是否应使用事务处理或客户确认,因为您不能同时选择两者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM