Custom Rollout Config for Rollout and Publish not working | Community
Skip to main content
February 9, 2021
Solved

Custom Rollout Config for Rollout and Publish not working

  • February 9, 2021
  • 1 reply
  • 1249 views

Hi,

I have a requirement to create a custom rollout config that performs rollout (adjust some properties) and publish.

I am using AEM 6.5.

 

I was able to successfully roll out the pages but unable to replicate them. Reference Replicator is always throwing null pointer exception

 

Please find the sample code below.

public class CustomLiveAction implements LiveAction {

private static final Logger LOG = LoggerFactory.getLogger(CustomLiveAction.class);
protected final String name;

publicCustomLiveAction(final String name) {
this.name = name;
}

@Override
public String getName() {
return name;
}

@Reference
private Replicator replicator;

@Override
public void execute(final Resource source, final Resource target, final LiveRelationship relation,
final boolean autoSave, final boolean isResetRollout) throws WCMException {
if (source != null && target != null) {
//code to replicate
replicator.replicate(..);

}
}

 

 

  1. How to get the reference of the replicator in live-action?
  2. What are the other options to replicate the pages after rolling out? 
  3. is it a best practice to publish language-masters and use Activate on blueprint activation trigger?
  4. is it a best practice to roll out and publish under the same operation?

 

 

 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SureshDhulipudi

https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-msm.html?lang=en#changing-language-names-and-default-countries

the above documentation has full details.

 

or , please see below

 

Did you declare your class as @8220494?

The following should work with the component

 

/** The replicator. */
@3214626
private Replicator replicator;
    
 
/**
* Replicate resource to Publish instance.
*
* @90521 session the session
*            
* @90521 resourcePath the resource path
*            
*/
@9944223
public void replicate(Session session, String resourcePath) {
try {
            // Set Replication Options
ReplicationOptions options = setReplicateOptions();
replicator.replicate(session, ReplicationActionType.ACTIVATE, resourcePath, options);
LOGGER.debug("Replicated resource at path : {} ", resourcePath);
} catch (ReplicationException repositoryException) {
LOGGER.error("repositoryException occurred while replicating the path::{}, exception{}", resourcePath,
repositoryException);
}
}
 
/**
* Sets the replicate options.
*
* @2007960 the replication options
*/
private ReplicationOptions setReplicateOptions() {
ReplicationOptions options = new ReplicationOptions();
options.setSuppressVersions(true);
options.setSynchronous(true);
options.setSuppressStatusUpdate(false);
return options;
}

1 reply

SureshDhulipudi
Community Advisor
SureshDhulipudiCommunity AdvisorAccepted solution
Community Advisor
February 9, 2021

https://experienceleague.adobe.com/docs/experience-manager-65/developing/extending-aem/extending-msm.html?lang=en#changing-language-names-and-default-countries

the above documentation has full details.

 

or , please see below

 

Did you declare your class as @8220494?

The following should work with the component

 

/** The replicator. */
@3214626
private Replicator replicator;
    
 
/**
* Replicate resource to Publish instance.
*
* @90521 session the session
*            
* @90521 resourcePath the resource path
*            
*/
@9944223
public void replicate(Session session, String resourcePath) {
try {
            // Set Replication Options
ReplicationOptions options = setReplicateOptions();
replicator.replicate(session, ReplicationActionType.ACTIVATE, resourcePath, options);
LOGGER.debug("Replicated resource at path : {} ", resourcePath);
} catch (ReplicationException repositoryException) {
LOGGER.error("repositoryException occurred while replicating the path::{}, exception{}", resourcePath,
repositoryException);
}
}
 
/**
* Sets the replicate options.
*
* @2007960 the replication options
*/
private ReplicationOptions setReplicateOptions() {
ReplicationOptions options = new ReplicationOptions();
options.setSuppressVersions(true);
options.setSynchronous(true);
options.setSuppressStatusUpdate(false);
return options;
}
Level 2
February 15, 2021
Thank you i am able to get the object