Hi @spidey1405,
Assuming you are using OOTB DAM Update Asset workflow then you can utilize information that is generated by DAM Update Asset Workflow Completed step. This step is also responsible to set dam:assetState property value to processed. As part of this step DAM_UPDATE_ASSET_WORKFLOW_COMPLETED event is send when DAM Update Asset workflow is completed. Having this knowledge, you can simply create event handler that will be listening on above topic. Here is very basic example:
package com.mysite.core.handler;
import com.day.cq.dam.api.DamEvent;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(
immediate = true,
service = EventHandler.class,
property = EventConstants.EVENT_TOPIC + "=" + DamEvent.EVENT_TOPIC)
public class DAMEventHandler implements EventHandler {
private static final Logger LOG = LoggerFactory.getLogger(DAMEventHandler.class);
@Override
public void handleEvent(Event event) {
DamEvent damEvent = DamEvent.fromEvent(event);
if (DamEvent.Type.DAM_UPDATE_ASSET_WORKFLOW_COMPLETED.equals(damEvent.getType())) {
LOG.info("Processed asset path: " + damEvent.getAssetPath());
// place for your code
}
}
}
and one more, but more complex:
Above solution will prevent you to check dam:assetState property periodically (for given asset) and generate unnecessary load on AEM instance.