@Override public void onAlertPublishSpecChange(PublishSpec pubSpec, Map<String, StreamDefinition> sds) { if (pubSpec == null) { return; } List<Publishment> newPublishments = pubSpec.getPublishments(); if (newPublishments == null) { LOG.info("no publishments with PublishSpec {} for this topology", pubSpec); return; } Map<String, Publishment> newPublishmentsMap = new HashMap<>(); newPublishments.forEach(p -> newPublishmentsMap.put(p.getName(), p)); MapComparator<String, Publishment> comparator = new MapComparator<>(newPublishmentsMap, cachedPublishments); comparator.compare(); List<Publishment> beforeModified = new ArrayList<>(); comparator.getModified().forEach(p -> beforeModified.add(cachedPublishments.get(p.getName()))); alertPublisher.onPublishChange( comparator.getAdded(), comparator.getRemoved(), comparator.getModified(), beforeModified); // switch cachedPublishments = newPublishmentsMap; specVersion = pubSpec.getVersion(); }