Search in sources :

Example 1 with SubscriptionStoreException

use of org.codice.ddf.catalog.subscriptionstore.internal.SubscriptionStoreException in project ddf by codice.

the class SubscriptionPersistor method insert.

/**
     * Add the subscription metadata to the persistent store using its id for the document key.
     * <p>
     * Insertion operations with the same key overwrite the previous value, which means a duplicate
     * being added is a no-op, minus the network overhead.
     *
     * @param metadata the subscription metadata to add to the persistent store.
     * @throws SubscriptionStoreException if a problem occurs during insert.
     */
public void insert(SubscriptionMetadata metadata) {
    LOGGER.debug("Adding [{}] to persistence store. ", metadata.getId());
    PersistentItem persistentSubscription = metadataToPersistentItem(metadata);
    try {
        persistentStore.add(PersistentStore.EVENT_SUBSCRIPTIONS_TYPE, persistentSubscription);
    } catch (PersistenceException e) {
        throw new SubscriptionStoreException("Exception while persisting subscription: ", e);
    }
}
Also used : SubscriptionStoreException(org.codice.ddf.catalog.subscriptionstore.internal.SubscriptionStoreException) PersistentItem(org.codice.ddf.persistence.PersistentItem) PersistenceException(org.codice.ddf.persistence.PersistenceException)

Aggregations

SubscriptionStoreException (org.codice.ddf.catalog.subscriptionstore.internal.SubscriptionStoreException)1 PersistenceException (org.codice.ddf.persistence.PersistenceException)1 PersistentItem (org.codice.ddf.persistence.PersistentItem)1