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"); openActiveMQ(); } catch (IllegalStateException e) { log.error("ActiveMQ State Error...reconnecting"); openActiveMQ(); } 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 ) { pendingAck.setFirstMessageId(pendingAck.getLastMessageId()); <<<<< this is the culprit } else if ( oldPendingAck.getAckType() == pendingAck.getAckType() ) { pendingAck.setFirstMessageId(oldPendingAck.getFirstMessageId()); 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 org.apache.activemq.ActiveMQMessageConsumer.ackLater(ActiveMQMessageConsumer.java:978) at org.apache.activemq.ActiveMQMessageConsumer.afterMessageIsConsumed(ActiveMQMessageConsumer.java:936) at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:602) at com.ngc.dcd.Phase1Ingest.nextDocId(Phase1Ingest.java:284) at com.ngc.dcd.Phase1Ingest$DocThread.run(Phase1Ingest.java:49) at java.lang.Thread.run(Unknown Source) -- View this message in context: http://activemq.2283324.n4.nabble.com/Error-recovering-from-sleep-tp4666054.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.