vitorvr
vitorvr

Reputation: 655

Artemis ActiveMQ - AMQ159005: Invalid Session Mode CLIENT_ACKNOWLEDGE

I'm trying to create a session with Acknowledge mode CLIENT and facing the following exception:

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

Code:

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>

I google the error code AMQ159005 and didn't find anything.

I need to create with this mode because I have a larger processing of messages and if I got some exception I need that the messages back to the Queue.

Thanks in advance.

Upvotes: 0

Views: 819

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 34988

A pooled-connection-factory is a JCA-based connection factory (from the Artemis JCA resource adapter) which doesn't allow CLIENT_ACKNOWLEDGE mode to be set on the session. See here. I recommend you use a normal (i.e. non JCA-based) connection factory.

Upvotes: 1

Related Questions