Programmatically delete a package after replication. | Community
Skip to main content
March 28, 2018
Solved

Programmatically delete a package after replication.

  • March 28, 2018
  • 2 replies
  • 1099 views

In our current implementation of programatic package creation and replication to boost performance we have two flows:

1. Programmatically create a package of name admin_package.zip which uses com.day.cq.wcm.api.PageManager.create(path, packagename) when ever activation of home page is detected.

2. Replicate package created  in step1 using com.day.cq.replication.Replicator.replicate(session, ReplicationActionType.ACTIVATE, package.getNode().getPath());

The issue with this implementation is that whenever more than one author is activating the content (concurrent activation issue even though different pages) code is creating package of same name which is "admin_package.zip" for  both the authors as both of them issued activation requests at the same time. This is throwing javax.jcr.ItemExistsException for second concurrent request and replication fails for that request.

So what we are assuming that we will add time stamp to the package name and then delete programatically the package after replication.

I am not getting the code how to do efficient deletion of package after replication in code. Has anyone done this type of implementation.

Or anyone has similar problem but followed a different approach.

Please let me know ideas and implementation details.

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 radhabbharathi

you can use PageMgr api : pagemanager.delete(resource,boolean)  , where resource will be your custom package.

2 replies

radhabbharathi
radhabbharathiAccepted solution
Level 2
March 29, 2018

you can use PageMgr api : pagemanager.delete(resource,boolean)  , where resource will be your custom package.

April 10, 2018

We are creating a purge service to remove old packages using JMX service.

Adobe CQ Help | How to Monitor Workflow via JMX