Replication listener in publish aem | Community
Skip to main content
Level 2
August 10, 2016
Solved

Replication listener in publish aem

  • August 10, 2016
  • 4 replies
  • 5085 views

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; } }
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Himanshu_Singhal

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 

4 replies

Lokesh_Shivalingaiah
Level 10
August 10, 2016

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 !

Level 2
August 10, 2016

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

Himanshu_Singhal
Community Advisor
Himanshu_SinghalCommunity AdvisorAccepted solution
Community Advisor
August 10, 2016

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 

kautuk_sahni
Community Manager
Community Manager
August 11, 2016

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