Does anybody knows how to intercept the event when a page or node gets Activated or Deactivated but for a specific Agent ?
I know that you can have a Replication Event Listener but that one gets call after the page gets Activated and doesn't say to which replication Agent it was replicated to.
I want to set a specific property in a page that gets Activated depending on the Agent that was sent to. Because the agents are triggered on different scenarios.
I have been trying to inject a ReplicationListener Interface in the Preprocess but that didn't work .
Does anyone have an idea how to achieve this? or point me in the right direction ?
What I did to answer a similar requirement was to actual do it before it technically replicated. So this would depend whether or not you needed to capture the event when its actually being replicated vs when the workflow is sending it to the queue of the specified replication agent. I created a custom replication workflow step. Inside that step there is a loop that goes through all the selected replication agents and calls replicator.replicate(...). The replication agents are actually included in that call because they are added to the ReplicationOptions parameter This is very similar to how the OOTB ReplicatePageProcess step works. I then insert my code to update a set of custom properties with the time stamp of when the page/resource was sent and to which replication agent. I also include the actual user who ran the replication steps as well. This way I can use this for anything going through a workflow whether its a page, asset, or something else defined in a workflow package.
I went this route because it was simpler to implement and there wasn't a client need to be 100% that the resource was already on a publish server. You could leverage a combination of my method and what the community article suggests and use your replication event listener to pull some temporary properties from the resource and update them when it was actually replicated.