Programmatically activate asset to preview server in AEM CLOUD SDK | Community
Skip to main content
Level 2
Jul 12, 2022 12:40 PM UTC
Solved

Programmatically activate asset to preview server in AEM CLOUD SDK

Hi Team , 


We are on AEM cloud .. instance   and we I an trying to push  some selective asset to preview server.

So I used 

Replication API.. and  filter and new options . which preview agent ID as the key.

but when I am trying to get the status of activation using the below code:

 

ReplicationStatus publishStatus = res.adaptTo(ReplicationStatus.Class)

publishStatus.getStatusForAgent("preview"). ( compilation error  -> no defined method as getStatusForAgent())

 

But ReplicationStatus API do not have any methods which will confirm if asset has been published on preview server.

 

Can you suggest on this please.

 

regards

Madhu

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
madhukumariAccepted solution
Level 2
Jul 13, 2022 7:38 AM UTC

Hi Sachin,

 

I too checked the same thing , it was all due to AEM SDK API version , as I switched to different SDK API version it started working .. 

 

Thanks for responding.

 

6 replies

Sachin_Arora_
New Participant
Jul 13, 2022 7:21 AM UTC

This method is available in ReplicationStatus. Please refer below doc for Cloud.

Java Doc : developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/replication/ReplicationStatus.html#getStatusForAgent(java.lang.String)

 

Please share the bundle version you are using of aem-sdk-api. I did not get compilation error with 2022.6 version.

 

Translate
madhukumariAuthorAccepted solution
Level 2
Jul 13, 2022 7:38 AM UTC

Hi Sachin,

 

I too checked the same thing , it was all due to AEM SDK API version , as I switched to different SDK API version it started working .. 

 

Thanks for responding.

 

Translate
Sachin_Arora_
New Participant
Jul 13, 2022 7:45 AM UTC

Thanks for confirmation. 

Happy Learning.

Translate
arunpatidar
New Participant
Jul 12, 2022 5:15 PM UTC
Level 2
Jul 12, 2022 5:23 PM UTC

hi Arun ,

 

Thank you for responding ..I am actually using the same link .... where in afterStatus.getStatusForAgent("preview").  is throwing error ... 

getStatusForAgent is not a method for ReplicationStatus API...  

 

I am trying to look in the API Version ... IF API difference is causing it

 

https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/com/day/cq/replication/package-summary.html   In this Link I see it is a valid method .. 

 

Regards

MAdhu

Translate
arunpatidar
New Participant
Jul 12, 2022 8:48 PM UTC

Can you check this from IDE/bundle, which API it is considering?

Translate
Arun Patidar