Get replication agent id in Replication EventHandler | Community
Skip to main content
New Participant
April 19, 2018
Solved

Get replication agent id in Replication EventHandler

  • April 19, 2018
  • 15 replies
  • 8486 views

Hello All,

I am implementing a replication event handler and one of the requirements is to get the replication agent id for each of the activate processes.

This is snippet of what I have written in the handleEvent method

ReplicationAction replicationAction = ReplicationAction.fromEvent(event);

if (null != replicationAction) {

String path = replicationAction.getPath();

String type = replicationAction.getType() != null ? replicationAction.getType().toString() : "";

LOG.info("Replication triggered {} for {} ", type, path);

String strReplicationAgentId = replicationAction.getConfig() != null ? replicationAction.getConfig().getAgentId() : "";

LOG.info("ReplicationAgentId: {}", strReplicationAgentId);

}

The issue is that the strReplicationAgentIdis always null.

I know that this is based on the runmodes, but not sure how to get the agent ids involved in the replication event.

Any guidance on how to achieve this will be very helpful.

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 joerghoh

When you check the information available for a replication event (localhost:4502/system/console/events), you can see that there is no agentID contained in it.

I think, that the replication event is sent per replication action (for example per page), and not per agent ID. That means a single replication event stands for the replication of a single resource via all available/configured replication agents.

Jörg

15 replies

New Participant
April 23, 2018

Yes, my replication agents are active and content is getting replicated successfully.

One thing I did notice in the logs further is that some how the event handler is getting invoked few seconds earlier than the actual replication happening.

Is this a possibility?

smacdonald2008
New Participant
April 20, 2018

We have an older community artilce that show how to create a Rep Event Handler -- Adobe CQ Help | Creating Replication Event Handlers for Adobe Experience Manager

We will update this soon to a more recent version of AEM.

New Participant
April 20, 2018

And you have an active replication agent? And whatever you publish actually gets replicated?

New Participant
April 19, 2018

Hi,

I did some more debugging and see that the AgentConfig object returned by replicationAction.getConfig() itself is null.

So all methods for the AgentConfig return null.

That is very strange and I am clueless

Vijayalakshmi_S
New Participant
April 19, 2018

Hi,

Can you try accessing any other methods of AgentConfig instead of getAgentId and see if you are able to get the result. Based on this, we can then narrow down to why we are not able to get the agentId.

AgentConfig ("The Adobe AEM Quickstart and Web Application.")