AMQCLI-3 - improve logging
authorChristopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Mon, 13 Mar 2017 13:02:06 +0000 (09:02 -0400)
committerChristopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Mon, 13 Mar 2017 13:02:06 +0000 (09:02 -0400)
activemq-kahadb-exporter/src/main/java/org/apache/activemq/cli/kahadb/exporter/KahaDBExporter.java
activemq-kahadb-exporter/src/main/java/org/apache/activemq/cli/kahadb/exporter/artemis/ArtemisXmlMetadataExporter.java

index ba5a0ef..f4801a1 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Set;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
+import org.apache.activemq.artemis.utils.SizeFormatterUtil;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -91,15 +92,20 @@ public class KahaDBExporter implements MessageStoreExporter {
 
         // loop through all queues and export them
         for (final ActiveMQDestination destination : destinations) {
-
-            LOG.info("Starting export of: " + destination);
             final MessageStore messageStore = destination.isQueue() ?
                     adapter.createQueueMessageStore((ActiveMQQueue) destination) :
                     adapter.createTopicMessageStore((ActiveMQTopic) destination);
 
             try {
+                messageStore.start();
+
+                LOG.info("Starting export of: {}; message count: {} message(s); message size: {}", destination,
+                        messageStore.getMessageCount(), SizeFormatterUtil.sizeof(
+                                messageStore.getMessageSize()));
+
                 // migrate the data
                 messageStore.recover(recoveryListener);
+                messageStore.stop();
             } catch (Exception e) {
                 IOExceptionSupport.create(e);
             }
index 216a6a3..d915ec9 100644 (file)
@@ -25,7 +25,6 @@ import org.apache.activemq.cli.kahadb.exporter.MessageStoreMetadataExporter;
 import org.apache.activemq.cli.schema.QueueBindingType;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.command.SubscriptionInfo;
-import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
 import org.apache.activemq.store.kahadb.KahaDBStore;
 
 public class ArtemisXmlMetadataExporter implements MessageStoreMetadataExporter {