Use Case: You are creating users and group on publish and want to move them on author
Prerequisite: http://helpx.adobe.com/cq/kb/HowToUseReverseReplication.html
Solution: Create two launcher on publish with run mode as publish which listen to rep:User and rep:Group on path /home/user and /home/group respectively and trigger reverse replication OR create one with rep:Authorizable and listen to /home
So it would be like
For User and Group Option 1
Event Type: Created
Nodetype: rep:User
Path: /home/users
Condition: cq:distribute!=
Workflow: /etc/workflow/models/reverse_replication
Run Mode: publish
AND
Event Type: Created
Nodetype: rep:Group
Path: /home/group
Condition: cq:distribute!=
Workflow: /etc/workflow/models/reverse_replication
Run Mode: publish
For User and Group Option 2
Event Type: Created
Nodetype: rep:Autherizable
Path: /home
Condition: cq:distribute!=
Workflow: /etc/workflow/models/reverse_replication
Run Mode: publish
For Profile
A. Code Changes
Change your code/form, that a profile update POST is adding
cq:distribute=true
source=authorname
as key=value into the /profile folder.
B. Setup on Publish Instance
Add Workflow Launcher Configuration:
Event Type: Modified
Nodetype: sling:Folder
Path: /home/users/(.*)/profile
Condition: cq:distribute!=
Workflow: /etc/workflow/models/reverse_replication
Run Mode: publish
C. Setup on Author Instance
Create Workflow Model:
One process step
Implementation: com.day.cq.wcm.workflow.process.ActivatePageProcess
Add Workflow Launcher Configuration:
Event Type: Modified
Nodetype: sling:Folder
Path: /home/users/(.*)/profile
Condition: source!=
Workflow: select your model created above
Run Mode: author
Important Note:
1) The above method will only work for the created triggers. If you are modifying the user profile on publish then you have to do the same thing for a modified trigger too.
2) If you have multiple publish instance then you have to make sure that all the publish instances are in sync. For that, you need to again replicate those users back to other publish instances using launcher on the author.
See an example of how to comment on activation work. when user post a comment in publish instance a comment post servlet gets called which add cq:distribute property to that node along with other properties -> this make node eligible for reverse replication -> publish instance put that node in outbox -> author reverse_publish agent poll data from publish and put it in /content/usergenerated -> Workflow launcher on Node Created /content/usergenerated of type cq:comment get called -> this calls workflow associated with it (Which is Comment Moderation workflow) -> workflow has logic to activate comment back to all publish instance based on whether it requires moderation or not (Simple replicator.replicate)
No comments:
Post a Comment
If you have any doubts or questions, please let us know.