我正在尝试创建一个带有确认模式客户端的会话,并面临以下异常:
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);
远程jmsDispatcher:
<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,但没有发现任何东西。
我需要用这个模式创建,因为我有一个更大的消息处理,如果我得到了一些异常,我需要将消息返回到队列。
事先谢谢。