Expandir minha barra de realizações na Comunidade.

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

Mark Solution

Esta conversa foi bloqueada devido à inatividade. Crie uma nova publicação.

SOLUCIONADO

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 Solução aceita

Avatar

Resposta correta de
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);

Ver solução na publicação original

4 Respostas

Avatar

Resposta correta de
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.