Expand my Community achievements bar.

SOLVED

Replication using Groovy

Avatar

Level 2

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!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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")

 

build-in-methods-gc.jpg

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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")

 

build-in-methods-gc.jpg