I'm not having much luck with the JMX viewer, but I turned on debug logging to get (I think) the same information.
It is very clear that there was two enqueues and one dequeue, with the dequeue of the "end-of-data marker" happening before the dequeue of the intended data. Log entries follow: INFO com.myapp.SourceSelectionReaderImpl - 1 rows were selected as roots in 602 milliseconds. DEBUG org.apache.activemq.broker.region.Queue - localhost Message ID:zip-54580-1457638742697-4:2:2:1:1 sent to queue://Stuff via SQL.401 DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401, subscriptions=2, memory=0%, size=1, pending=0 toPageIn: 1, Inflight: 0, pagedInMessages.size 0, pagedInPendingDispatch.size 0, enqueueCount: 1, dequeueCount: 0, memUsage:2214 INFO com.myapp.SelectedDataJmsWriter - Committed 1 thing to redo log and JMS queue *** Emphasis added - Note that the end of stream marker is posted second *** INFO com.myapp.SourceSelectionReaderImpl - Returning empty thing and end-of-stream placeholder. DEBUG org.apache.activemq.broker.region.Queue - localhost Message ID:zip-54580-1457638742697-4:2:2:1:2 sent to queue://Stuff via SQL.401 DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401, subscriptions=2, memory=0%, size=2, pending=0 toPageIn: 1, Inflight: 1, pagedInMessages.size 1, pagedInPendingDispatch.size 0, enqueueCount: 2, dequeueCount: 0, memUsage:3155 INFO com.myapp.SelectedDataJmsWriter - Committed 1 thing to redo log and JMS queue *** Emphasis added - note that the end of stream marker is retrieved first, the first one is still marked as inflight *** INFO com.myapp.SelectedDataJmsReader - executed read, found end-of-stream marker, returning null DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401, subscriptions=2, memory=0%, size=1, pending=0 toPageIn: 0, Inflight: 1, pagedInMessages.size 1, pagedInPendingDispatch.size 0, enqueueCount: 2, dequeueCount: 1, memUsage:1107 DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401, subscriptions=2, memory=0%, size=1, pending=0 toPageIn: 0, Inflight: 1, pagedInMessages.size 1, pagedInPendingDispatch.size 0, enqueueCount: 2, dequeueCount: 1, memUsage:1107 DEBUG org.apache.activemq.broker.region.AbstractRegion - localhost removing consumer: ID:zip-54580-1457638742697-4:1:2:1 for destination: queue://Stuff via SQL.401 DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401 remove sub: QueueSubscription: consumer=ID:zip-54580-1457638742697-4:1:2:1, destinations=1, dispatched=0, delivered=0, pending=0, lastDeliveredSeqId: 9, dequeues: 1, dispatched: 2, inflight: 1, groups: 0 DEBUG org.apache.activemq.broker.region.Queue - queue://Stuff via SQL.401, subscriptions=1, memory=0%, size=1, pending=0 toPageIn: 0, Inflight: 1, pagedInMessages.size 1, pagedInPendingDispatch.size 0, enqueueCount: 2, dequeueCount: 1, memUsage:1107 INFO org.springframework.batch.core.launch.support.SimpleJobLauncher - Job: [FlowJob: [name=archive-purge]] completed with the following parameters: [{jobName=Stuff via SQL}] and the following status: [COMPLETED] -- View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-JMS-losing-messages-what-am-I-missing-tp4709127p4709178.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.