AEM | Why doesn't a Sling ContentDistribution Event provide the deepPaths event property?

Viewed 322

I have created an OSGi EventHandler to know about the Sling CD events, here is the sample class.

@Component(immediate = true,
        property = {
                "event.topics=org/apache/sling/distribution/agent/package/distributed",
                "event.filter=(|(distribution.type=ADD)(distribution.type=DELETE))"
        })
public class MyEventHandler implements EventHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

    @Override
    public void handleEvent(Event event) {
        // consume event.
    }
}

When a content is distributed from AEM using the Add Tree option, the deepPaths field in org.apache.sling.distribution.SimpleDistributionRequest is initialised but it is not sent to the event handler.

This way we never get to know that it was a tree activation. So, is there a way to know about the deepPaths using this approach?

I found out that if we subscribe to this topic org/apache/sling/event/notification/job/FINISHED and filter on (|(distribution.request.type=ADD)(distribution.request.type=DELETE)) we can get the deepPaths as well as several other event properties but I am not sure if that would be right approach.

Please suggest.

0 Answers
Related