Artemis ActiveMQ - AMQ159005:无效会话模式 CLIENT_ACKNOWLEDGE
Artemis ActiveMQ - AMQ159005: Invalid Session Mode CLIENT_ACKNOWLEDGE
我正在尝试使用确认模式 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>
我 google 错误代码 AMQ159005 但没有找到任何东西。
我需要用这种模式创建,因为我有更多的消息处理,如果我遇到一些异常,我需要将消息返回到队列。
提前致谢。
A pooled-connection-factory
是一个基于 JCA 的连接工厂(来自 Artemis JCA 资源适配器),它不允许在会话中设置 CLIENT_ACKNOWLEDGE
模式。参见 here。我建议您使用普通的(即非基于 JCA 的)连接工厂。
我正在尝试使用确认模式 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>
我 google 错误代码 AMQ159005 但没有找到任何东西。
我需要用这种模式创建,因为我有更多的消息处理,如果我遇到一些异常,我需要将消息返回到队列。
提前致谢。
A pooled-connection-factory
是一个基于 JCA 的连接工厂(来自 Artemis JCA 资源适配器),它不允许在会话中设置 CLIENT_ACKNOWLEDGE
模式。参见 here。我建议您使用普通的(即非基于 JCA 的)连接工厂。