activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdblack98 <>
Subject Error recovering from sleep
Date Fri, 19 Apr 2013 12:01:05 GMT
I am trying to write a topic consumer that is as robust as possible to
virtually all errors.

So far, so good....but now I've hit an error that's not mine and appears to
be inside the receive chain.
The connection is client ack which I think is what caused this problem.  

session = conn.createTopicSession(false, TopicSession.CLIENT_ACKNOWLEDGE);
I'm using activemq-all-5.7.0.jar

Here's my function
		public static Message nextDocId() {
			Message msgrx = null;
			try {
				msgrx = subscriber.receive(10*1000);
			catch (JMSException e) {
				log.error("ActiveMQ Receive Error...reconnecting");
			catch (IllegalStateException e) {
				log.error("ActiveMQ State Error...reconnecting");
			return msgrx;

After I put my machine in sleep state I got this error on wakeup -- I do
have code which detects the connection is broken and reestablishes it.
I looked at line 978 in 5.7.0
        if( oldPendingAck==null ) {
<<<<< this is the culprit
        } else if ( oldPendingAck.getAckType() == pendingAck.getAckType() )

So I think my client may have tried to ack the last message it received on
the old connection perhaps?
At any rate it appears getLastMessageId() returned null in this case which
should be some sort of error I would think.
I also may have been that the receive() was waiting for a message and that
sequence may have been trying to continue on wakeup even though the
connection was broken.

Exception in thread "Thread-3" java.lang.NullPointerException
	at com.ngc.dcd.Phase1Ingest.nextDocId(
	at com.ngc.dcd.Phase1Ingest$
	at Source)

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message