Artemis ActiveMQ-AMQ159005:无效的会话模式CLIENT_ACKNOWLEDGE

时间:2018-08-27 18:55:30

标签: jms activemq-artemis

我正在尝试使用确认模式CLIENT创建会话,并且遇到以下异常:

JMSException: Could not create a session: AMQ159005: Invalid Session Mode CLIENT_ACKNOWLEDGE

代码:

import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.ConnectionFactory;

ConnectionFactory factory = (ConnectionFactory) initialContext.lookup("java:/RemoteJmsDispatcher");

private Connection conn;
conn = factory.createConnection();

private Session session;
session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);

RemoteJmsDispatcher:

 <pooled-connection-factory name="activemq-ra-remote-dispatcher" entries="java:/RemoteJmsDispatcher java:jboss/exported/jms/ConnectionFactory" connectors="netty-remote-dispatcher" min-large-message-size="524288" client-id="wildfly-dev" retry-interval="5000" max-retry-interval="5000" group-id="my-broadcast-group" user="xxxxx" password="xxxxx" enlistment-trace="true">
     <inbound-config use-jndi="true" rebalance-connections="true" use-local-tx="false"/>
 </pooled-connection-factory>

我搜索了错误代码AMQ159005,但没有找到任何内容。

我需要使用此模式进行创建,因为我对消息的处理量更大,如果遇到异常,我需要将消息返回到队列。

谢谢。

1 个答案:

答案 0 :(得分:1)

init:function(){ this.control({ '#downloadSite': { load:function(tree, node, records, successful, eOpts) { }, itemclick: function(tree, record, item, index) { if(record.get('id') == 300){ window.open('Download.php?file=../TAB/'+record.get('url')); } else{ window.open('Download.php?file=../PDF/'+record.get('url')); } }, beforeitemclick: function(tree, record, item, index) { if(record.get('leaf') == false) return false; }, beforeitemdblclick: function(){ return false; } } }); } 是基于JCA的连接工厂(来自Artemis JCA资源适配器),不允许在会话上设置pooled-connection-factory模式。参见here。我建议您使用普通的(即非基于JCA的)连接工厂。