Replication using Groovy | Community
Skip to main content
Level 2
May 26, 2023 1:57 PM UTC
Solved

Replication using Groovy

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.
lukasz-m
lukasz-mAccepted solution
New Participant
May 26, 2023 2:08 PM UTC

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
lukasz-mAccepted solution
New Participant
May 26, 2023 2:08 PM UTC

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

 

Translate