Hi There,
We have a custom workflow, which indexes a published page to Search Index (External). However when a user previews a page it indexes page to search index. We are already using `getAgentId` function from AgentConfig instance but Agent Config is always null even when both preview and publish replication agent instances are configured.
replicationAction.getConfig().getAgentId()
Using `Event` class's `getProperty()` returns all replication agent Ids
event.getProperty("agentIds")
Is there any other way to know which instance given page is being published to preview or publish
Solved! Go to Solution.
Views
Replies
Total Likes
Hi There,
I would like to answer my question as I found a (probable) solution and its working for us. Instead of relying on AgentConfig.
ReplicationAction.fromEvent(event).getConfig()
We are relying on Event config agentIds
List <String> agentIds = (List<String>) event.getProperty("agentIds");
agentIds.contains("publish");
agentIds from Event objects contains all agentIds on which page is going to be replicated and activated
Thanks
I don't fully understand what you are asking, but here are some thoughts that may be useful:
- The replication configuration is static, meaning that you will know exactly how many replication agents you have and how/when any of these will be used. For example, if you run a workflow or activate a page you will know prior hand to which environment the page will be published.
- You can actually get the replication agents programmatically by using Agent Manager API https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/index.html?com/day/cq...
- A page does not let any trace of to which information it was "deliver", you can check this form ore details https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/replicatio... . But if you need to track if a page was published to one specific server you need to customize that action, either you add a property upon activation or you can check if the node is present in the target server.
Hope this helps.
In gist, I just want to know if page being activated is activated to publish server or preview server from event instance or ReplicationAction instance.
Hi @bagwanpankaj There's no way you can find out if a page is published to specific server/instance. For that you need to run queries in specific servers(publish) then probably reverse replicate to author and then index it based on what you get back.
Thanks
-Bilal
Hi There,
I would like to answer my question as I found a (probable) solution and its working for us. Instead of relying on AgentConfig.
ReplicationAction.fromEvent(event).getConfig()
We are relying on Event config agentIds
List <String> agentIds = (List<String>) event.getProperty("agentIds");
agentIds.contains("publish");
agentIds from Event objects contains all agentIds on which page is going to be replicated and activated
Thanks
If i understood your issue, you have different replication agents for live publishers and preview publishers. There is an option for authors to only publish content to preview publishers and when that happens your custom workflow is updating search index. If all this what i mentioned is true, how is custom workflow getting triggered? Is it configured to trigger whenever a page is published? If yes, then go to preview publish replication agent and on "Triggers" tab select "No status update" checkbox. This will ensure that your page when published to preview server will not get updated with replication status which should in turn not trigger your custom workflow. Hope this helps!
Views
Likes
Replies
Views
Likes
Replies