AEM as CS | Handle event on page publish | Community
Skip to main content
Level 3
Aug 22, 2022 1:17 PM UTC
Solved

AEM as CS | Handle event on page publish

Hello Team,

How do we handle page activation custom event on AEM as CS ?. Like we were handling in version <= 6.5 sling event.

We are trying to do something on publishing/activating the page with event handler using EventConstants.EVENT_TOPIC + "=" + ReplicationAction.EVENT_TOPIC which works fine in local but not on Cloud.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Employee
Aug 22, 2022 2:12 PM UTC

The replication mechanism itself is implemented differently in CS and SDK, but the event after having received an incoming replication should be identical.

3 replies

Jagadeesh_Prakash
New Participant
Aug 22, 2022 1:33 PM UTC

@pradeepmoolemane Below code worked for us

 

@Component(immediate = true, property = { "event.topics=org/apache/sling/distribution/importer/package/imported",
"event.filter=(|(distribution.type=ADD)(distribution.type=DELETE))" })
public class SlingDistributionEventHandler implements EventHandler {
public static final String DISTRIBUTION_PATHS = "distribution.paths";

@Override
public void handleEvent(Event event) {
if (event.getProperty(DISTRIBUTION_PATHS) != null) {
String[] pagePath = (String[]) event.getProperty(DISTRIBUTION_PATHS);

}
}
Translate
Level 3
Aug 22, 2022 1:57 PM UTC

Hi were you able to validate this in local SDK setup ?.

Translate
joerghoh
joerghohAccepted solution
Employee
Aug 22, 2022 2:12 PM UTC

The replication mechanism itself is implemented differently in CS and SDK, but the event after having received an incoming replication should be identical.

Translate