3 Replies Latest reply on Jan 31, 2013 12:02 PM by rush_pawan

    Control replication & replication agents through Workflow.

    mailtovinay11 Level 1

      Hi,

       

      we have a requirement where in we need to enable & disable replication agents through a java process. Is it possible ?

       

      Thanks

      Vinay

        • 1. Re: Control replication & replication agents through Workflow.
          rush_pawan Level 4

          Hello Vinay,

           

          Not sure if there is method to disable the agent through API because the enable/disable property is configuration property and stored with that agent in CQ (for example /etc/replication/agents.author/publish/jcr:content). But what you can do to accomplish that is as below.

           

          AgentManager agentMgr = sling.getService(AgentManager.class);

          or

          @Reference

          AgentManager agentMgr;

           

           

          Agent agent = agentMgr.getAgents().get(id);

          AgentConfig cfg = agent == null ? null : agent.getConfiguration();

          String agentPath=cfg.getConfigPath();

          Node agentNode=resourceresolver.getResource(agentPath).adaptTo(Node.class);

          agentNode.setProperty("enabled",false);

           

          I hope above helps you to proceed.

           

          Thanks,

          Pawan

          • 2. Re: Control replication & replication agents through Workflow.
            Abhinav_Sap Level 1

            Pawan, I had a related question. Is it a posibility to progrmatically replicate a node/content from author to publish without using the replication agent (even if the corresponding publish replication agents are disabled)

            • 3. Re: Control replication & replication agents through Workflow.
              rush_pawan Level 4

              Hello Abhinav,

               

              I dont think there is any other OOTB/API way which allows you to publish node without using agent. You have to use agent, as these are the only API which has been created to manage the replication and all other stuff related to replication until you are planning to write something which can stand parallel to replication api .

               

              Thanks,

              Pawan