Publish/replication to Preview events/agents | Community
Skip to main content
Level 3
October 18, 2024

Publish/replication to Preview events/agents

  • October 18, 2024
  • 2 replies
  • 676 views

Hi again, 
Would like to ask if there would be a function in replication preprocessor that could check/return a value if the current page/resource is being published to Preview or Publish environment?  

2 replies

lukasz-m
Community Advisor
Community Advisor
October 18, 2024

Hi @lyonmartin,

I think you can try to get the information which agent is used, base on agent Id that can be retrieved from ReplicationAction object. So in preprocessor implementation it should be possible like this:

public void preprocess(ReplicationAction replicationAction, ReplicationOptions replicationOptions) throws ReplicationException { String agentId = replicationAction.getConfig().getAgentId(); }

In general in cloud setup you have agent with publish id that represents publish tier, and preview id for preview publish. Both are mentioned in the official documentation:

Level 3
October 21, 2024

so, when I tried to test the snippet, config seems null even on the replicationAction itself. 

therefore I got a null pointer when calling the "agentId()"


And on the side note: can we also setup a Publish to preview on local AEM?
Thanks!

 

kautuk_sahni
Community Manager
Community Manager
November 26, 2024

@lyonmartin Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni