From b53a0b258d06f999dd90a85efa11dfcdf92f194a Mon Sep 17 00:00:00 2001 From: Benjamin Phillippe Date: Tue, 21 Jan 2014 13:00:31 -0600 Subject: [PATCH] Issue #2613 Registry performance enhancements. Better handling of delete events. Change-Id: I56d3f5c37778e717810b6a698ec9405ed3cde00a Former-commit-id: f863897fd512acae11364eb6b4737339b5951da0 --- .../regrep/xsd/rim/v4/ObjectRefType.java | 26 ++++ .../bandwidth-datadelivery-edex-impl-ncf.xml | 1 - .../registry-federation-datadelivery.xml | 1 - .../federation/RegistryFederationManager.java | 4 +- .../res/spring/ebxml-registry-dao.xml | 1 + .../ebxml/dao/AuditableEventTypeDao.java | 134 ++++++++++++++++-- .../ebxml/services/AuditableEventService.java | 30 +++- .../lifecycle/LifecycleManagerImpl.java | 3 +- .../NotificationListenerImpl.java | 4 + .../RegistryNotificationManager.java | 53 ++++--- .../RegistrySubscriptionManager.java | 17 ++- .../query/plugins/GetNotification.java | 12 +- 12 files changed, 239 insertions(+), 47 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java index 90b3aa9063..b29c134dbb 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java @@ -77,6 +77,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * among multiple ref lists * 12/2/2013 1829 bphillip Modified persistence annotations, added * constructors, hashCode, toString and equals + * 01/21/2014 2613 bphillip Added equals and hashcode * * * @author bphillip @@ -144,6 +145,31 @@ public class ObjectRefType implements IPersistableDataObject { this.key = key; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ObjectRefType other = (ObjectRefType) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml index ff7f87b06b..ffd26a10ef 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-ncf.xml @@ -22,7 +22,6 @@ - diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml index 084a818f77..792e13219a 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery.xml @@ -24,7 +24,6 @@ value="com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager.addObjectTypesToSubscribeTo" /> - Test Object Type urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Federation urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Registry urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java index 07f8f7125a..5a27bd63c2 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java @@ -156,6 +156,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 12/2/2013 1829 bphillip Modified to use correct getters for slot values * 12/9/2013 2613 bphillip Optimized registry sync function * 1/15/2014 2613 bphillip Added leaveFederation method to prevent inactive registries from participating in the federation unintentionally. + * 1/21/2014 2613 bphillip Changed max down time which requires a sync * * * @author bphillip @@ -188,8 +189,7 @@ public class RegistryFederationManager implements RegistryInitializedListener { * The maximum time a registry can be down before a full synchronization is * performed */ - private static final long MAX_DOWN_TIME_DURATION = TimeUtil.MILLIS_PER_DAY - * 2 - TimeUtil.MILLIS_PER_HOUR; + private static final long MAX_DOWN_TIME_DURATION = TimeUtil.MILLIS_PER_HOUR * 6; /** The central registry mode string */ private static final String CENTRAL_REGISTRY_MODE = "centralRegistry"; diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml index aaf2455f2e..9e734ca8ec 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml @@ -74,6 +74,7 @@ + * @@ -79,14 +91,14 @@ public class AuditableEventTypeDao extends + "left outer join action.affectedObjectRefs as AffectedObjectRefs " + "left outer join AffectedObjects.registryObject as RegistryObjects " + "left outer join AffectedObjectRefs.objectRef as ObjRefs " - + "where (ObjRefs.id in (:ids) OR RegistryObjects.id in (:ids) OR action.eventType = :eventType) and event.timestamp >= :startTime"; + + "where (ObjRefs.id in (:ids) OR RegistryObjects.id in (:ids)) and event.timestamp >= :startTime"; /** * Query to find deleted events */ private static final String FIND_DELETED_EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event " + "left outer join event.action as action " - + "where action.eventType = :eventType and event.timestamp >= :startTime"; + + "where action.eventType = 'urn:oasis:names:tc:ebxml-regrep:ActionType:delete' and event.timestamp > :startTime"; /** Optional end time clause */ private static final String END_TIME_CLAUSE = " and event.timestamp <= :endTime"; @@ -104,6 +116,17 @@ public class AuditableEventTypeDao extends private static final String GET_EXPIRED_EVENTS_QUERY = "FROM AuditableEventType event where event.timestamp < :" + GET_EXPIRED_EVENTS_QUERY_CUTOFF_PARAMETER; + /** The registry soap services */ + private RegistrySOAPServices soapService; + + /** Sorter for sorting events */ + private static final Comparator EVENT_TIME_COMPARATOR = new Comparator() { + @Override + public int compare(AuditableEventType o1, AuditableEventType o2) { + return o2.getTimestamp().compare(o1.getTimestamp()); + } + }; + /** * Constructor. * @@ -134,6 +157,100 @@ public class AuditableEventTypeDao extends .getTimeInMillis())); } + /** + * Gets all auditable events which reference the objects of interest. + * + * @param subscription + * The subscription to get the events for + * @param serviceAddress + * The address to the registry to use to verify deleted objects + * @param startTime + * The start time boundary of the query + * @param endTime + * The end time boundary of the query + * @param objectsOfInterest + * The objects of interest to get events for + * @return The list of auditable events referencing the objects of interest + * @throws EbxmlRegistryException + * @throws MsgRegistryException + */ + public List getEventsOfInterest( + SubscriptionType subscription, String serviceAddress, + XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, + List objectsOfInterest) + throws EbxmlRegistryException, MsgRegistryException { + List events = new ArrayList(0); + if (!objectsOfInterest.isEmpty()) { + events = getEventsOfInterest(FIND_EVENTS_OF_INTEREST_QUERY, + startTime, endTime, objectsOfInterest); + } + List deleteEvents = getDeleteEventsOfInterest( + subscription, serviceAddress, startTime, endTime); + if (!deleteEvents.isEmpty()) { + events.addAll(deleteEvents); + } + Collections.sort(events, EVENT_TIME_COMPARATOR); + return events; + } + + /** + * Gets applicable delete events + * + * @param subscription + * The subscription to get the events for + * @param serviceAddress + * The address to the registry to use to verify deleted objects + * @param startTime + * The start time boundary of the query + * @param endTime + * The end time boundary of the query + * @return The list of auditable events referencing deleted objects + * @throws EbxmlRegistryException + * @throws MsgRegistryException + */ + private List getDeleteEventsOfInterest( + SubscriptionType subscription, String serviceAddress, + XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) + throws EbxmlRegistryException, MsgRegistryException { + + List retVal = new LinkedList(); + List deletedEvents = getEventsOfInterest( + FIND_DELETED_EVENTS_OF_INTEREST_QUERY, startTime, endTime, null); + try { + URL url = new URL(serviceAddress); + String baseURL = url.toString().replace(url.getPath(), ""); + List remoteRefs = soapService + .getQueryServiceForHost(baseURL) + .executeQuery( + new QueryRequest( + "Deleted Objects of Interest Query for [" + + subscription.getId() + "]", + subscription.getSelector(), + new ResponseOptionType( + QueryReturnTypes.OBJECT_REF, false))) + .getObjectRefList().getObjectRef(); + + for (AuditableEventType event : deletedEvents) { + for (ActionType action : event.getAction()) { + if (action.getAffectedObjectRefs() != null + && !action.getAffectedObjectRefs().getObjectRef() + .isEmpty()) { + if (remoteRefs.contains(action.getAffectedObjectRefs() + .getObjectRef().get(0))) { + retVal.add(event); + } + } + } + } + } catch (MalformedURLException e) { + throw new EbxmlRegistryException( + "Error parsing notification address", e); + } + + return retVal; + + } + /** * Gets the events of interest based on the start time, end time, and the * list of objects of interest @@ -147,13 +264,10 @@ public class AuditableEventTypeDao extends * @return The list of auditable events of interest within the constrains of * the start time, end time and including the objects of interest */ - public List getEventsOfInterest( + private List getEventsOfInterest(String query, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, List objectsOfInterest) { - String query = FIND_DELETED_EVENTS_OF_INTEREST_QUERY; - List queryParams = new ArrayList(4); - queryParams.add("eventType"); - queryParams.add(ActionTypes.delete); + List queryParams = new ArrayList(2); queryParams.add("startTime"); queryParams.add(startTime); if (!CollectionUtil.isNullOrEmpty(objectsOfInterest)) { @@ -241,4 +355,8 @@ public class AuditableEventTypeDao extends return AuditableEventType.class; } + public void setSoapService(RegistrySOAPServices soapService) { + this.soapService = soapService; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java index 8aca1d5895..4cf7b7eb58 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.edex.registry.ebxml.services; +import java.util.ArrayList; import java.util.List; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType; @@ -34,6 +35,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType; import org.springframework.transaction.annotation.Transactional; import com.google.common.eventbus.Subscribe; +import com.raytheon.uf.common.registry.constants.ActionTypes; import com.raytheon.uf.common.registry.constants.RegistryObjectTypes; import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; @@ -59,6 +61,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent; * 10/23/2013 1538 bphillip Removed call to subscription manager. Subscriptions will now * only be run on a quartz timer * 12/2/2013 1829 bphillip Now uses event bus for triggering auditable event generation + * 01/21/2014 2613 bphillip Changed how auditable events are created for deletes * * * @@ -103,12 +106,27 @@ public class AuditableEventService { public void createAuditableEventFromObjects( CreateAuditTrailEvent registryEvent) throws EbxmlRegistryException { if (!CollectionUtil.isNullOrEmpty(registryEvent.getObjectsAffected())) { - AuditableEventType event = createEvent(registryEvent.getRequest(), - TimeUtil.currentTimeMillis()); - addRegistryObjectActionToEvent(event, - registryEvent.getActionType(), - registryEvent.getObjectsAffected()); - auditDao.createOrUpdate(event); + long currentTime = TimeUtil.currentTimeMillis(); + if (ActionTypes.delete.equals(registryEvent.getActionType())) { + for (RegistryObjectType obj : registryEvent + .getObjectsAffected()) { + List regObjList = new ArrayList( + 1); + regObjList.add(obj); + AuditableEventType event = createEvent( + registryEvent.getRequest(), currentTime); + addRegistryObjectActionToEvent(event, + registryEvent.getActionType(), regObjList); + auditDao.createOrUpdate(event); + } + } else { + AuditableEventType event = createEvent( + registryEvent.getRequest(), currentTime); + addRegistryObjectActionToEvent(event, + registryEvent.getActionType(), + registryEvent.getObjectsAffected()); + auditDao.createOrUpdate(event); + } } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java index 5640c0c25b..823260a8a8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java @@ -107,6 +107,7 @@ import com.raytheon.uf.edex.registry.events.CreateAuditTrailEvent; * Nov 08, 2013 2506 bgonzale Added RegistryObjectType to RemoveRegistryEvent. * Separate update from create notifications. * 12/2/2013 1829 bphillip Auditable events are not genereted via messages on the event bus + * 01/21/2014 2613 bphillip Removed verbose log message from removeObjects * * * @@ -230,8 +231,6 @@ public class LifecycleManagerImpl implements LifecycleManager { statusHandler .info("No results returned from remove objects query"); } else { - statusHandler.info("Remove objects query returned " - + queryResponse.getRegistryObjects() + " objects"); objectsToRemove.addAll(queryResponse.getRegistryObjects()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java index d2016cb718..10895c79a8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java @@ -92,6 +92,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 10/30/2013 1538 bphillip Changed to use non-static registry soap service client * 12/2/2013 1829 bphillip Added getIdsFrom action method and changed how slots are added to objects * 1/15/2014 2613 bphillip Added batching of notification update queries to reduce number of web service calls + * 01/21/2014 2613 bphillip Added home slot to remove objects request so delete events are properly handled * * * @@ -192,6 +193,9 @@ public class NotificationListenerImpl implements NotificationListener { "Notification delete object submission", null, null, refList, false, true, DeletionScope.DELETE_ALL); + request.getSlot().add( + new SlotType(EbxmlObjectUtil.HOME_SLOT_NAME, + new StringValueType(clientBaseURL))); try { lcm.removeObjects(request); } catch (MsgRegistryException e) { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java index 5d2fdc042a..8c7cf1e95f 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java @@ -74,6 +74,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 10/23/2013 1538 bphillip Adding log messages and changed methods to handle DateTime value on * AuditableEvents instead of integer * 12/9/2013 2613 bphillip Changed start time boundary of get auditable events to be the last run time of the subscription + * 01/21/2014 2613 bphillip Changed start time boundary again and also a few minor cleanup items * * * @author bphillip @@ -136,12 +137,16 @@ public class RegistryNotificationManager { * @param objectsOfInterest * The objects to get events for * @return The events of interest for the given set of objects + * @throws MsgRegistryException + * @throws EbxmlRegistryException */ public List getEventsOfInterest( + SubscriptionType subscription, String serviceAddress, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime, - List objectsOfInterest) { - return this.auditableEventDao.getEventsOfInterest(startTime, endTime, - objectsOfInterest); + List objectsOfInterest) + throws EbxmlRegistryException, MsgRegistryException { + return this.auditableEventDao.getEventsOfInterest(subscription, + serviceAddress, startTime, endTime, objectsOfInterest); } /** @@ -221,28 +226,26 @@ public class RegistryNotificationManager { * If errors occur while sending the notifications * @throws MsgRegistryException */ - protected void sendNotifications( - SubscriptionNotificationListeners notificationListeners) - throws EbxmlRegistryException, MsgRegistryException { + protected XMLGregorianCalendar sendNotifications( + SubscriptionNotificationListeners notificationListeners, + XMLGregorianCalendar startTime) throws EbxmlRegistryException, + MsgRegistryException { + // Object to hold the last timestampe of the latest event in order to + // update the subscription last run time correctly + XMLGregorianCalendar lastTime = null; final List listeners = notificationListeners.listeners; final SubscriptionType subscription = notificationListeners.subscription; List objectsOfInterest = getObjectsOfInterest(subscription); - XMLGregorianCalendar startTime = subscription - .getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME); - - if (startTime == null) { - startTime = subscription.getStartTime(); - } - - List eventsOfInterest = getEventsOfInterest( - subscription.getStartTime(), subscription.getEndTime(), - objectsOfInterest); - - if (!eventsOfInterest.isEmpty()) { - for (NotificationListenerWrapper listener : listeners) { + for (NotificationListenerWrapper listener : listeners) { + List eventsOfInterest = getEventsOfInterest( + subscription, listener.address, startTime, + subscription.getEndTime(), objectsOfInterest); + if (!eventsOfInterest.isEmpty()) { + lastTime = eventsOfInterest.get(eventsOfInterest.size() - 1) + .getTimestamp(); int subListCount = eventsOfInterest.size() / notificationBatchSize; int lastListSize = eventsOfInterest.size() @@ -281,6 +284,7 @@ public class RegistryNotificationManager { } } + return lastTime; } /** @@ -326,23 +330,28 @@ public class RegistryNotificationManager { List actionList = event.getAction(); for (ActionType action : actionList) { objectsToRemove.clear(); + refsToRemove.clear(); if (action.getAffectedObjectRefs() != null) { List objRefs = action .getAffectedObjectRefs().getObjectRef(); for (ObjectRefType obj : objRefs) { boolean found = objectInList(objectsOfInterest, obj); - if (!found && !action.equals(ActionTypes.delete)) { + if (!found + && !action.getEventType().equals( + ActionTypes.delete)) { refsToRemove.add(obj); } } - objRefs.removeAll(objectsToRemove); + objRefs.removeAll(refsToRemove); } else if (action.getAffectedObjects() != null) { List regObjs = action .getAffectedObjects().getRegistryObject(); for (RegistryObjectType obj : regObjs) { boolean found = objectInList(objectsOfInterest, obj); - if (!found && !action.equals(ActionTypes.delete)) { + if (!found + && !action.getEventType().equals( + ActionTypes.delete)) { objectsToRemove.add(obj); } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java index 52074c75ac..07c6bc51d8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java @@ -81,6 +81,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 11/20/2013 2534 bphillip Moved method to get notification destinations to utility * 12/9/2013 2613 bphillip Setting last run time of subscription now occurs before notification is sent * 1/15/2014 2613 bphillip Added Hibernate flush and clear after subscription processing + * 01/21/2014 2613 bphillip Changed how last run time is updated for replication subscriptions * * * @author bphillip @@ -388,9 +389,19 @@ public class RegistrySubscriptionManager implements } statusHandler.info("Processing subscription [" + subscriptionName + "]..."); - updateLastRunTime(subscription, TimeUtil.currentTimeMillis()); - notificationManager.sendNotifications(listeners - .get(subscriptionName)); + XMLGregorianCalendar startTime = subscription + .getSlotValue(EbxmlObjectUtil.SUBSCRIPTION_LAST_RUN_TIME_SLOT_NAME); + + if (startTime == null) { + startTime = subscription.getStartTime(); + } + XMLGregorianCalendar lastEventTime = notificationManager + .sendNotifications(listeners.get(subscriptionName), + startTime); + if (lastEventTime != null) { + updateLastRunTime(subscription, lastEventTime + .toGregorianCalendar().getTimeInMillis()); + } } catch (Throwable e) { statusHandler.error( "Errors occurred while processing subscription [" diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java index 29e1716f40..743004d5e5 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetNotification.java @@ -64,6 +64,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * Jun 24, 2013 2106 djohnson Requires a transaction to be open, will not create one. * 10/8/2013 1682 bphillip Refactored querying * 11/20/2013 2534 bphillip Changed call to getNotificationDestinations which is not in a utility class + * 01/21/2014 2613 bphillip Modifications to account for changed method signatures in RegistryNotificationManager * * * @@ -135,8 +136,15 @@ public class GetNotification extends RegistryQueryPlugin { List objectsOfInterest = notificationManager .getObjectsOfInterest(subscription); - List eventsOfInterest = notificationManager - .getEventsOfInterest(startTime, null, objectsOfInterest); + List eventsOfInterest = null; + try { + eventsOfInterest = notificationManager.getEventsOfInterest( + subscription, destinations.get(0).getDestination(), + startTime, null, objectsOfInterest); + } catch (EbxmlRegistryException e1) { + throw EbxmlExceptionUtil.createMsgRegistryException( + "Error getting events!", e1); + } try { return createResponse(Arrays.asList(notificationManager .getNotification(subscription, "Test Address",