Reputation: 5381
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
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
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 aActiveMQException
with error codeActiveMQException.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()
, orprepare()
, then the transaction will be automatically rolled back and Apache ActiveMQ Artemis will throw ajavax.jms.TransactionRolledBackException
(if using JMS), or aActiveMQException
with error codeActiveMQException.TRANSACTION_ROLLED_BACK
if using the core API.
Upvotes: 2