Skip to content

Implement Custom CQ Rollout Action

January 29, 2014

A LiveAction is an action that is executed on each resource that is involved in the rollout. A rollout is an operation that copies the contents from blueprint to its livecopies.

CQ supplies out of the box rollout configs live contentUpdate, contentCopy, contentDelete, referencesUpdate, orderChildren, markLiveRelationship etc.

Create the Example Rollout Configuration and edit rollout config

Create the MSM rollout configuration that uses the LiveAction that you are going to create.

  1. In your web browser, open the Tools console. (http://localhost:4502/miscadmin#/etc)
  2. Select the Tools/MSM/Rollout Configurations folder and click New > New Page and provide values for the Rollout Configuration properties:
  • Title: Example Rollout Configuration
  • Name: examplerolloutconfig
  • Select RolloutConfig Template.
Click Create.

  1. Open the rollout configuration that is created and then click Edit.
  2. In the Rollout Config dialog, use the Sync-Trigger drop-down menu to select On Activation, and then click OK.

Add the custom Live Action(exampleLiveAction) to the Example Rollout Configuration

Configure the rollout configuration that you created in the previous procedure so that it uses the ExampleLiveActionFactory class.

  • Open CRXDE Lite. (http://localhost:4502/crx/de)

  • Select the jcr:content node below the /etc/msm/rolloutconfigs/examplerolloutconfig/jcr:content node.

  • Click Create > Create Node, configure the following node properties and click OK:

    • Name: exampleLiveAction
    • Type: cq:LiveSyncAction
  • Click Save All.

  • Select the exampleLiveAction node and add the following property:

    • Name: repLastModBy
    • Type: Boolean
    • Value: true

    This property indicates to the ExampleLiveAction class that the cq:LastModifiedBy property should be replicated from the source to the target node.

  • Click Save All.

Create Example live action that implements the custom live action.


import ...;

@Component(label = "Custom MSM Live Action", description = "Custom MSM Live Action", immediate = true, metatype = false, enabled = true)
 @Property(label = "Vendor", name = Constants.SERVICE_VENDOR, value = "Vendor", propertyPrivate = true),
 @Property(label = "Name", value = "exampleLiveAction", description = "Custom Live Action", name = "", propertyPrivate = true),
 @Property(label = "parameter", value = "msm:exampleLiveAction", description = "Parameter", name = "cq.wcm.msm.action.parameter", propertyPrivate = true),
 @Property(label = "Title", value = "Custom MSM Live Action", description = "Custom MSM Live Action", name = "cq.wcm.msm.action.title", propertyPrivate = true),
 @Property(label = "Rank", intValue = 10, name = "cq.wcm.msm.action.rank", description = "Custom LiveAction Rank"),
 @Property(label = "Properties", value = { "enabled" }, cardinality = Integer.MAX_VALUE, name = "", description = "Custom LiveAction Properties") })
public class CustomLiveActionImpl implements LiveAction, CustomLiveAction {
 private int rank;
 private String name;
 private String title;
 private String[] parameterNames;
 private Dictionary<String, Object> prop;

 public void execute(Resource resource, Resource resource2, LiveRelationship liveRelationship,
 boolean b, boolean b2)
 throws WCMException {

 public void execute(ResourceResolver resolver, LiveRelationship relation, ActionConfig config,
 boolean autoSave) throws WCMException {
 //execute(resolver, relation, config, autoSave, false);

 public void execute(ResourceResolver resolver, LiveRelationship relation,ActionConfig config,
 boolean autoSave, boolean isResetRollout)
 throws WCMException {

 public void customLiveActionImplementation() {
 // custom live action implementation

 public String getParameterName() {

 public void write(JSONWriter jsonWriter) throws JSONException {
 for (String prop : getPropertiesNames()) {

 public String[] getPropertiesNames() {
 return parameterNames;

 * OSGi Component Methods
 protected void activate(ComponentContext context) {
 Dictionary<String, Object> properties = context.getProperties();
 name = PropertiesUtil.toString(
 properties.get(""), "exampleLiveAction");
 title = PropertiesUtil.toString(
 properties.get("cq.wcm.msm.action.title"), "Custom Live Action");
 rank = PropertiesUtil.toInteger(
 properties.get("cq.wcm.msm.action.rank"), Integer.MAX_VALUE);
 parameterNames = PropertiesUtil.toStringArray(
 properties.get(""), new String[0]);

 protected void deactivate(ComponentContext context) {"Deactivating Custom rollout action.");

 private final static String ACTION_PARAMETER = "msm:exampleLiveAction";

public interface CustomLiveAction {
void customLiveActionImplementation();

From → Day/Adobe CQ

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: