Replication using Groovy | Community
Skip to main content
Level 2
May 26, 2023
Solved

Replication using Groovy

  • May 26, 2023
  • 1 reply
  • 1598 views

Hi,

I am writing script to replicate a page using groovy console. But I am always getting the Replicator instance as null.

What is the best way to get Replicator instance in groovy?

 

Thanks!

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 lukasz-m

Hi @mvelicheti,

You can get Replicator object instance using getService method from Groovy Console

 

import com.day.cq.replication.Replicator Replicator Replicator = getService(Replicator.class)

 

Alternatively you can use other build in methods like activate and deactivate in that case you do not need to get Replicator object.

 

acitvate("/content/path/page") deactivate("/content/path/page")

 

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
May 26, 2023

Hi @mvelicheti,

You can get Replicator object instance using getService method from Groovy Console

 

import com.day.cq.replication.Replicator Replicator Replicator = getService(Replicator.class)

 

Alternatively you can use other build in methods like activate and deactivate in that case you do not need to get Replicator object.

 

acitvate("/content/path/page") deactivate("/content/path/page")