Package org.apache.activemq.store.kahadb

Examples of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter$DelegateDestinationMap


    @Override
    protected void configureBroker(BrokerService broker) throws Exception {
        super.configureBroker(broker);

        MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
        List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>();
        FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
        defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
        adapters.add(defaultEntry);

        FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
        special.setDestination(new ActiveMQQueue("special"));
        special.setPersistenceAdapter(new KahaDBPersistenceAdapter());
        adapters.add(special);

        mKahaDB.setFilteredPersistenceAdapters(adapters);
        broker.setPersistenceAdapter(mKahaDB);
    }
View Full Code Here


        return kaha;
    }

    public void prepareBrokerWithMultiStore(boolean deleteAllMessages) throws Exception {

        MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
        if (deleteAllMessages) {
            multiKahaDBPersistenceAdapter.deleteAllMessages();
        }
        ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();

        adapters.add(createFilteredKahaDBByDestinationPrefix(PREFIX_DESTINATION_NAME, deleteAllMessages));
        adapters.add(createFilteredKahaDBByDestinationPrefix(PREFIX_DESTINATION_NAME + "2", deleteAllMessages));
        adapters.add(createFilteredKahaDBByDestinationPrefix(null, deleteAllMessages));

        multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);
        broker = createBroker(multiKahaDBPersistenceAdapter);
    }
View Full Code Here

    @Override
    protected void configureBroker(BrokerService broker) throws Exception {
        super.configureBroker(broker);

        MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
        List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>();
        FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
        defaultEntry.setPersistenceAdapter(new LevelDBPersistenceAdapter());
        adapters.add(defaultEntry);

        FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
        special.setDestination(new ActiveMQQueue("special"));
        special.setPersistenceAdapter(new LevelDBPersistenceAdapter());
        adapters.add(special);

        mKahaDB.setFilteredPersistenceAdapters(adapters);
        broker.setPersistenceAdapter(mKahaDB);
    }
View Full Code Here

        master.addConnector(MASTER_URL);
        master.setUseJmx(false);
        master.setPersistent(true);
        master.setDeleteAllMessagesOnStartup(true);

        MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
        List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>();
        FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
        defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
        defaultEntry.setPerDestination(true);
        adapters.add(defaultEntry);

        mKahaDB.setFilteredPersistenceAdapters(adapters);
        master.setPersistenceAdapter(mKahaDB);

        master.start();
    }
View Full Code Here

                    // no need for broker.setMasterConnectorURI(masterConnectorURI)
                    // as the db lock provides the slave/master initialisation
                    broker.setUseJmx(false);
                    broker.setPersistent(true);

                    MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
                    List adapters = new LinkedList<FilteredKahaDBPersistenceAdapter>();
                    FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
                    defaultEntry.setPersistenceAdapter(new KahaDBPersistenceAdapter());
                    defaultEntry.setPerDestination(true);
                    adapters.add(defaultEntry);

                    mKahaDB.setFilteredPersistenceAdapters(adapters);
                    broker.setPersistenceAdapter(mKahaDB);
                    broker.start();
                    slave.set(broker);
                    slaveStarted.countDown();
                } catch (IllegalStateException expectedOnShutdown) {
View Full Code Here

           prepareBrokerWithMultiStore(true);
    }

    public void prepareBrokerWithMultiStore(boolean deleteAllMessages) throws Exception {

        MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
        if (deleteAllMessages) {
            multiKahaDBPersistenceAdapter.deleteAllMessages();
        }
        ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();

        FilteredKahaDBPersistenceAdapter theRest = new FilteredKahaDBPersistenceAdapter();
        theRest.setPersistenceAdapter(createStore(deleteAllMessages));
        // default destination when not set is a match for all
        adapters.add(theRest);

        // separate store for FastQ
        FilteredKahaDBPersistenceAdapter fastQStore = new FilteredKahaDBPersistenceAdapter();
        fastQStore.setPersistenceAdapter(createStore(deleteAllMessages));
        fastQStore.setDestination(new ActiveMQQueue("FastQ"));
        adapters.add(fastQStore);

        multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);
        brokerService  = createBroker(multiKahaDBPersistenceAdapter);
    }
View Full Code Here

    public void testRollbackRecovery() throws Exception {
        doTestRecovery(false);
    }

    public void doTestRecovery(final boolean haveOutcome) throws Exception {
        final MultiKahaDBPersistenceAdapter persistenceAdapter =
                (MultiKahaDBPersistenceAdapter) brokerService.getPersistenceAdapter();
        MultiKahaDBTransactionStore transactionStore =
                new MultiKahaDBTransactionStore(persistenceAdapter) {
                    @Override
                    public void persistOutcome(Tx tx, TransactionId txid) throws IOException {
                        if (haveOutcome) {
                            super.persistOutcome(tx, txid);
                        }
                        try {
                            // IOExceptions will stop the broker
                            persistenceAdapter.stop();
                        } catch (Exception e) {
                            LOG.error("ex on stop ", e);
                            exceptions.add(e);
                        }
                    }
                };
        persistenceAdapter.setTransactionStore(transactionStore);
        brokerService.start();

        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(new Runnable() {
            @Override
View Full Code Here

        assertEquals("all transactions are complete", 0, brokerService.getBroker().getPreparedTransactions(null).length);
    }

    @Test
    public void testDirectoryDefault() throws Exception {
        MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
        ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();

        FilteredKahaDBPersistenceAdapter otherFilteredKahaDBPersistenceAdapter =
                new FilteredKahaDBPersistenceAdapter();
        PersistenceAdapter otherStore = createStore(false);
        File someOtherDisk = new File("target" + File.separator + "someOtherDisk");
        otherStore.setDirectory(someOtherDisk);
        otherFilteredKahaDBPersistenceAdapter.setPersistenceAdapter(otherStore);
        otherFilteredKahaDBPersistenceAdapter.setDestination(new ActiveMQQueue("Other"));
        adapters.add(otherFilteredKahaDBPersistenceAdapter);

        FilteredKahaDBPersistenceAdapter filteredKahaDBPersistenceAdapterDefault =
                new FilteredKahaDBPersistenceAdapter();
        PersistenceAdapter storeDefault = createStore(false);
        filteredKahaDBPersistenceAdapterDefault.setPersistenceAdapter(storeDefault);
        adapters.add(filteredKahaDBPersistenceAdapterDefault);

        multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);

        assertEquals(multiKahaDBPersistenceAdapter.getDirectory(), storeDefault.getDirectory().getParentFile());
        assertEquals(someOtherDisk, otherStore.getDirectory().getParentFile());
    }
View Full Code Here

        return kaha;
    }

    public void prepareBrokerWithMultiStore(boolean deleteAllMessages) throws Exception {

        MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
        if (deleteAllMessages) {
            multiKahaDBPersistenceAdapter.deleteAllMessages();
        }
        ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();

        FilteredKahaDBPersistenceAdapter template = new FilteredKahaDBPersistenceAdapter();
        template.setPersistenceAdapter(createStore(deleteAllMessages));
        template.setPerDestination(true);
        adapters.add(template);

        multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);
        broker = createBroker(multiKahaDBPersistenceAdapter);
    }
View Full Code Here

        return kaha;
    }

    public void prepareBrokerWithMultiStore(boolean deleteAllMessages) throws Exception {

        MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
        if (deleteAllMessages) {
            multiKahaDBPersistenceAdapter.deleteAllMessages();
        }
        ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();

        FilteredKahaDBPersistenceAdapter template = new FilteredKahaDBPersistenceAdapter();
        template.setPersistenceAdapter(createStore(deleteAllMessages));
        template.setPerDestination(true);
        adapters.add(template);

        multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);
        broker = createBroker(multiKahaDBPersistenceAdapter);
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter$DelegateDestinationMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.