Search in sources :

Example 1 with PagingStore

use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.

the class PostOfficeImpl method setPagingStore.

// Private -----------------------------------------------------------------
private void setPagingStore(SimpleString address, Message message) throws Exception {
    PagingStore store = pagingManager.getPageStore(address);
    message.setContext(store);
}
Also used : PagingStore(org.apache.activemq.artemis.core.paging.PagingStore)

Example 2 with PagingStore

use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.

the class AbstractJournalStorageManager method locateSubscription.

/**
 * @param queueID
 * @param pageSubscriptions
 * @param queueInfos
 * @return
 */
private static PageSubscription locateSubscription(final long queueID, final Map<Long, PageSubscription> pageSubscriptions, final Map<Long, QueueBindingInfo> queueInfos, final PagingManager pagingManager) throws Exception {
    PageSubscription subs = pageSubscriptions.get(queueID);
    if (subs == null) {
        QueueBindingInfo queueInfo = queueInfos.get(queueID);
        if (queueInfo != null) {
            SimpleString address = queueInfo.getAddress();
            PagingStore store = pagingManager.getPageStore(address);
            subs = store.getCursorProvider().getSubscription(queueID);
            pageSubscriptions.put(queueID, subs);
        }
    }
    return subs;
}
Also used : QueueBindingInfo(org.apache.activemq.artemis.core.persistence.QueueBindingInfo) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) PageSubscription(org.apache.activemq.artemis.core.paging.cursor.PageSubscription) PagingStore(org.apache.activemq.artemis.core.paging.PagingStore)

Example 3 with PagingStore

use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.

the class JournalStorageManager method getPageInformationForSync.

/**
 * @param pagingManager
 * @return
 * @throws Exception
 */
private Map<SimpleString, Collection<Integer>> getPageInformationForSync(PagingManager pagingManager) throws Exception {
    Map<SimpleString, Collection<Integer>> info = new HashMap<>();
    for (SimpleString storeName : pagingManager.getStoreNames()) {
        PagingStore store = pagingManager.getPageStore(storeName);
        info.put(storeName, store.getCurrentIds());
        store.forceAnotherPage();
    }
    return info;
}
Also used : HashMap(java.util.HashMap) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Collection(java.util.Collection) PagingStore(org.apache.activemq.artemis.core.paging.PagingStore)

Example 4 with PagingStore

use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.

the class JournalStorageManager method sendPagesToBackup.

/**
 * @param pageFilesToSync
 * @throws Exception
 */
private void sendPagesToBackup(Map<SimpleString, Collection<Integer>> pageFilesToSync, PagingManager manager) throws Exception {
    for (Map.Entry<SimpleString, Collection<Integer>> entry : pageFilesToSync.entrySet()) {
        if (!started)
            return;
        PagingStore store = manager.getPageStore(entry.getKey());
        store.sendPages(replicator, entry.getValue());
    }
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Collection(java.util.Collection) HashMap(java.util.HashMap) Map(java.util.Map) PagingStore(org.apache.activemq.artemis.core.paging.PagingStore)

Example 5 with PagingStore

use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.

the class PagingStoreFactoryDatabase method reloadStores.

@Override
public synchronized List<PagingStore> reloadStores(final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception {
    // We assume the directory list < Integer.MAX_VALUE (this is only a list of addresses).
    JDBCSequentialFile directoryList = (JDBCSequentialFile) pagingFactoryFileFactory.createSequentialFile(DIRECTORY_NAME);
    directoryList.open();
    int size = ((Long) directoryList.size()).intValue();
    ActiveMQBuffer buffer = readActiveMQBuffer(directoryList, size);
    ArrayList<PagingStore> storesReturn = new ArrayList<>();
    while (buffer.readableBytes() > 0) {
        SimpleString table = buffer.readSimpleString();
        JDBCSequentialFileFactory factory = (JDBCSequentialFileFactory) newFileFactory(table.toString(), false);
        factory.start();
        JDBCSequentialFile addressFile = (JDBCSequentialFile) factory.createSequentialFile(ADDRESS_FILE);
        addressFile.open();
        size = ((Long) addressFile.size()).intValue();
        if (size == 0) {
            continue;
        }
        ActiveMQBuffer addrBuffer = readActiveMQBuffer(addressFile, size);
        SimpleString address = addrBuffer.readSimpleString();
        AddressSettings settings = addressSettingsRepository.getMatch(address.toString());
        PagingStore store = new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, factory, this, address, settings, executorFactory.getExecutor(), syncNonTransactional);
        storesReturn.add(store);
    }
    directoryList.close();
    return storesReturn;
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) ArrayList(java.util.ArrayList) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) JDBCSequentialFile(org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile) PagingStore(org.apache.activemq.artemis.core.paging.PagingStore) JDBCSequentialFileFactory(org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactory) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer)

Aggregations

PagingStore (org.apache.activemq.artemis.core.paging.PagingStore)48 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)31 Test (org.junit.Test)24 Configuration (org.apache.activemq.artemis.core.config.Configuration)19 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)17 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)17 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)17 DatabaseStorageConfiguration (org.apache.activemq.artemis.core.config.storage.DatabaseStorageConfiguration)17 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)16 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)15 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)15 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)15 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)11 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)11 HashMap (java.util.HashMap)9 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)9 Queue (org.apache.activemq.artemis.core.server.Queue)9 PagedMessage (org.apache.activemq.artemis.core.paging.PagedMessage)8 ArrayList (java.util.ArrayList)7 Page (org.apache.activemq.artemis.core.paging.impl.Page)6