Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Replication listener in publish aem

Avatar

Level 3

I am trying to write a listener which listens to page activation but in Publish Environment. The code which I have written works in author environment but doesn't in publish, i.e. it doesn't listen to Replication even in pub environment. I have attached the underlying code. Any help is highly appreciated.

 

@Component @Service @Properties({ @Property( label = "Event Topics", value = { ReplicationAction.EVENT_TOPIC }, description = "[Required] Event Topics this event handler will to respond to.", name = EventConstants.EVENT_TOPIC, propertyPrivate = true ), @Property( label = "Event Filters", value = "(" + ReplicationAction.PROPERTY_TYPE + "=ACTIVATE)", name = EventConstants.EVENT_FILTER, propertyPrivate = true ) }) public class SimpleDSComponent implements Runnable, EventHandler { private Logger log = LoggerFactory.getLogger(this.getClass()); private BundleContext bundleContext; public void handleEvent(Event event) { String n[] = event.getPropertyNames(); log.info(""); log.info("Event occurred: {}", event.getProperty(WorkflowEvent.EVENT_TYPE)); log.info("Event properties: "); for(String s : n) { log.info(s + " = " + event.getProperty(s)); } ReplicationAction action = ReplicationAction.fromEvent(event); if(action != null) { log.info("Replication action {} occured on {} ", action.getType().getName(), action.getPath()); log.info("Tushar Replication"); } log.info(""); } public void run() { log.info("Running..."); } protected void activate(ComponentContext ctx) { this.bundleContext = ctx.getBundleContext(); } protected void deactivate(ComponentContext ctx) { this.bundleContext = null; } }
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Check the replication queue of replication agent on author. As you already know, replication agent on author is responsible for replicating content from author to publish.
So, if you don't see activated page in replication queue, that way, you can get to know page is published.

 

~Himanshu 

View solution in original post

4 Replies

Avatar

Level 10

Hi Tushar,

'Activate' event would be triggered on Author instance when you activate content from author to publish instance. I dont think activate event would be triggered on publish instance !

Avatar

Level 3

Do you have any solution for this, like how can i get to know if a page has got published in Publish Environment

Avatar

Correct answer by
Community Advisor

Check the replication queue of replication agent on author. As you already know, replication agent on author is responsible for replicating content from author to publish.
So, if you don't see activated page in replication queue, that way, you can get to know page is published.

 

~Himanshu 

Avatar

Administrator

Hi

Adding to Himanshu's answer, 

Go to :- http://localhost:4502/etc/replication/agents.author.html

            Go to default Agent and click it (if you have configured more of the agent then you may open them also).

            Here you can check the Replication Queue, all the item listed there would be in a queue.

            View log will show you all Replication log, here you can verify all the statues

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni 



Kautuk Sahni