Développer ma barre des réalisations de la Communauté.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

Cette conversation a été verrouillée en raison de son inactivité. Veuillez créer une nouvelle publication.

RÉSOLU

How to publish an asset/page programmatically in AEMaaCS?

Avatar

Level 9

Team - In the past, we used Replicator (com.day.cq.replication.Replicator) to activate pages programmatically. Currently, I'm trying to publish assets and pages in a custom workflow in AEMaacS. 

 

AEMaaCS does not use the replication agents used in previous versions of AEM. As I understand it, content in AEM Cloud Service is replicated using Sling Content Distribution to a pipeline service that is not part of AEM.

 

Could you please tell me what APIs should be used to call appropriate distributions to publish a specific asset?

 
 
1 solution acceptée

Avatar

Réponse correcte par
Community Advisor

@Mario248 

In AEM Cloud as well you can use Replicator API to activate resources. In cloud you don't need to provide any replication agent via ReplicationOptions. Replicator API picks the only active agent in AEM cloud which is "publish" agent.

So below code should work as its working for me in my workflow process.

@Reference
private Replicator replicator;
replicator.replicate(session, ReplicationActionType.ACTIVATE, assetPath);

Voir la solution dans l'envoi d'origine

4 Replies

Avatar

Réponse correcte par
Community Advisor

@Mario248 

In AEM Cloud as well you can use Replicator API to activate resources. In cloud you don't need to provide any replication agent via ReplicationOptions. Replicator API picks the only active agent in AEM cloud which is "publish" agent.

So below code should work as its working for me in my workflow process.

@Reference
private Replicator replicator;
replicator.replicate(session, ReplicationActionType.ACTIVATE, assetPath);

Avatar

Level 9

Thanks but I want to call specific distribution service. I have 3 distributions or agents, those are preview, publish and Publish to brand portal. In this case i want to publish only Publish to brand portal agent. Is it possible ?

Avatar

Community Advisor

Yes, you can call specific distribution service like this.

@Reference
private Replicator replicator; ReplicationOptions options = new ReplicationOptions(); options.setFilter(new AgentFilter() { @Override public boolean isIncluded (Agent agent) { return agent.getId().equals(DISTRIBITION_SERVICE_NAME); //PUBLISH or PREVIEW or any other distribution service you have } }); replicator.replicate(session,ReplicationActionType.ACTIVATE, assetPath, options);

Avatar

Level 9

Thank you for your response.