简体   繁体   中英

ActiveMQ Spring CLIENT_ACKNOWLEDGE not working

I can't seem to figure this out... This works perfectly in 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. 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. Transactions overrides any acknowledge modes. So, choose if you should go with transactions or client ack since you cannot pick both.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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