private void exportDestinations()

in activemq-kahadb-exporter/src/main/java/org/apache/activemq/cli/kahadb/exporter/KahaDBExporter.java [81:113]


    private void exportDestinations(ActiveMQDestination destPattern) throws IOException {

        //Main destination filter
        final DestinationFilter destFilter = DestinationFilter.parseFilter(destPattern);
        //Secondary filter to catch a couple of extra edge cases
        final Predicate<ActiveMQDestination> f = getExportDestinationFilter(destPattern);

        final Set<ActiveMQDestination> destinations = adapter.getDestinations().stream()
                .filter(dest -> destFilter.matches(dest))
                .filter(f)
                .collect(Collectors.toSet());

        // loop through all queues and export them
        for (final ActiveMQDestination destination : destinations) {
            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);
            }
        }
    }