Viraj
Viraj

Reputation: 5381

ActiveMQ Artemis: producer fails with JMSException AMQ219016

We have an instance of ActiveMQ Artemis 2.14.0 with a queue and producer which sometimes fails with following error:

javax.jms.JMSException: AMQ219016: Connection failure detected. Unblocking a blocking call that will never get a response
    at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:467) ~[artemis-jms-client-all-2.14.0.jar!/:2.14.0] 

We need to understand the scenarios where this might arise. We see this happens from time to time, and we don't know the exact situation. Has anyone experienced this and can offer any solution?

Upvotes: 0

Views: 3166

Answers (2)

Vadim Pilipenko
Vadim Pilipenko

Reputation: 11

Duplicated it here, because I spent too much time to discover solution with similiar problem.

.transacted() option removed this problem:

from("timer:hello?period=10s")
               .routeId("hello1")
               .transacted()
               .setBody(simple("This is plain string"))
               .to("jms:queue:consumerQueueName");

java 18 + wildfly 20 + artemis 2.25.0

all via JNDI

Upvotes: 0

Justin Bertram
Justin Bertram

Reputation: 35008

The documentation has a good description for why this exception might be thrown:

If the client code is in a blocking call to the server, waiting for a response to continue its execution, when failover occurs, the new session will not have any knowledge of the call that was in progress. This call might otherwise hang for ever, waiting for a response that will never come.

To prevent this, Apache ActiveMQ Artemis will unblock any blocking calls that were in progress at the time of failover by making them throw a javax.jms.JMSException (if using JMS), or a ActiveMQException with error code ActiveMQException.UNBLOCKED. It is up to the client code to catch this exception and retry any operations if desired.

If the method being unblocked is a call to commit(), or prepare(), then the transaction will be automatically rolled back and Apache ActiveMQ Artemis will throw a javax.jms.TransactionRolledBackException (if using JMS), or a ActiveMQException with error code ActiveMQException.TRANSACTION_ROLLED_BACK if using the core API.

Upvotes: 2

Related Questions